|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldman.collection.AbstractCollection.AbstractLocator<E>
goldman.collection.positional.TrackedArray.Tracker
protected class TrackedArray.Tracker
Field Summary | |
---|---|
protected goldman.collection.positional.TrackedArray.Node<E> |
trackedNode
|
Fields inherited from class goldman.collection.AbstractCollection.AbstractLocator |
---|
versionNumber |
Constructor Summary | |
---|---|
protected |
TrackedArray.Tracker(goldman.collection.positional.TrackedArray.Node<E> toTrack)
|
Method Summary | |
---|---|
PositionalCollectionLocator<E> |
addAfter(E e)
Adds to the collection after the tracker location If the tracker is between positions p-1 , and p then
the new element is inserted at position p . |
boolean |
advance()
Moves the tracker to the next position |
boolean |
equals(Object tracker)
|
E |
get()
Returns the element associated with this locator. |
int |
getCurrentPosition()
Returns the position within the collection for this locator. |
boolean |
hasNext()
|
boolean |
inCollection()
Returns true if and only if the locator is at an element of the collection. |
void |
remove()
Removes the element at the tracker and updates the tracker to be between its current position and the one before it. |
boolean |
retreat()
Moves the tracker to the previous position |
E |
set(E element)
|
Methods inherited from class goldman.collection.AbstractCollection.AbstractLocator |
---|
checkValidity, ignoreConcurrentModifications, ignorePriorConcurrentModifications, next, updateVersion |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface goldman.collection.Locator |
---|
ignoreConcurrentModifications, ignorePriorConcurrentModifications |
Methods inherited from interface java.util.Iterator |
---|
next |
Field Detail |
---|
protected goldman.collection.positional.TrackedArray.Node<E> trackedNode
Constructor Detail |
---|
protected TrackedArray.Tracker(goldman.collection.positional.TrackedArray.Node<E> toTrack)
toTrack
- the node to track.
IllegalArgumentException
- the property TracksElement would be violatedMethod Detail |
---|
public boolean inCollection()
Locator
inCollection
in interface Locator<E>
public E get()
Locator
inCollection
method can be
used to determine if a tracked element is currently in the collection.
If the locator is at FORE or AFT then
a NoSuchElementException
is thrown.
get
in interface Locator<E>
NoSuchElementException
- the tracker is not at an element
in the collection.public E set(E element)
element
- the element to store at the current tracker location.
NoSuchElementException
- the tracker is not at an element in
the collectionpublic int getCurrentPosition()
PositionalCollectionLocator
getCurrentPosition
in interface PositionalCollectionLocator<E>
NoSuchElementException
- the tracker is not at an
element in the collectionpublic boolean advance() throws ConcurrentModificationException
advance
in interface Locator<E>
AtBoundaryException
- the tracker is at AFT, since there is
no place to advance.
ConcurrentModificationException
public boolean retreat() throws ConcurrentModificationException
retreat
in interface Locator<E>
AtBoundaryException
- the tracker is at FORE, since then there is
no place to retreat.
ConcurrentModificationException
public boolean hasNext() throws ConcurrentModificationException
hasNext
in interface Iterator<E>
ConcurrentModificationException
public PositionalCollectionLocator<E> addAfter(E e)
p-1
, and p
then
the new element is inserted at position p
.
addAfter
in interface PositionalCollectionLocator<E>
e
- the element to be added
AtBoundaryException
- the tracker is at AFTpublic void remove()
remove
in interface Iterator<E>
NoSuchElementException
- the tracker is not at a valid position
in the collectionpublic boolean equals(Object tracker)
equals
in class Object
tracker
- the tracker to be checked for equality
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |