|
||||||||||
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.AbstractCollection.VisitingIterator
public class AbstractCollection.VisitingIterator
Field Summary |
---|
Fields inherited from class goldman.collection.AbstractCollection.AbstractLocator |
---|
versionNumber |
Constructor Summary | |
---|---|
AbstractCollection.VisitingIterator()
|
Method Summary | |
---|---|
boolean |
advance()
Advances to the next element in the collection (if there is one) and returns true . |
void |
cancel()
Aborts iteration to terminate the visiting iterator thread when iteration to completion is not required. |
E |
get()
Returns the element associated with this locator. |
boolean |
hasNext()
|
void |
ignoreConcurrentModifications(boolean ignore)
Sets the version number of the locator to MAX_VALUE when ignore is true, preventing
concurrent modification exceptions from occurring. |
void |
ignorePriorConcurrentModifications()
Resets the version number of the locator to the current modification count for the data structure object. |
boolean |
inCollection()
Returns true if and only if the locator is at an element of the collection. |
E |
next()
Moves the locator forward to the next element in the collection. |
void |
remove()
|
boolean |
retreat()
Retreats to the previous element in the collection (if there is one) and returns true . |
void |
run()
Calls the accept method on the collection provided to the constructor |
void |
visit(E item)
Called during traversal with each element of the collection being passed as the parameter. |
Methods inherited from class goldman.collection.AbstractCollection.AbstractLocator |
---|
checkValidity, updateVersion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractCollection.VisitingIterator()
Method Detail |
---|
public void run()
accept
method on the collection provided to the constructor
run
in interface Runnable
public void cancel()
hasNext
will return false.
public void visit(E item) throws Exception
Visitor
visit
in interface Visitor<E>
item
- the
element to visit
Exception
public boolean hasNext()
hasNext
in interface Iterator<E>
public E next()
AbstractCollection.AbstractLocator
next
in interface Iterator<E>
next
in class AbstractCollection.AbstractLocator<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>
public boolean inCollection()
Locator
inCollection
in interface Locator<E>
public boolean advance()
Locator
true
. If the locator is already
at the last element of the collection then false
is returned
and the locator is moved to AFT.
If a call to advance
is made when the locator is at AFT,
an AtBoundaryException
is thrown. Starting with the locator
at FORE and calling advance
repeatedly until
false is returned will reach each element in the collection
exactly once.
advance
in interface Locator<E>
public boolean retreat()
Locator
true
. If the locator is already
at the first element of the collection then false
is returned and
the locator is moved to FORE.
If a call to retreat
is made when the Locator is at FORE,
an AtBoundaryException
is thrown. Starting with the locator
at AFT and calling retreat
repeatedly until
false is returned will reach each element in the underlying collection
exactly once, in the reverse order.
retreat
in interface Locator<E>
public void remove()
remove
in interface Iterator<E>
public void ignoreConcurrentModifications(boolean ignore)
AbstractCollection.AbstractLocator
MAX_VALUE
when ignore
is true, preventing
concurrent modification exceptions from occurring.
When ignore
is false, it restores the
version number to the smaller of the locator's version number and the current
modification count for the data structure object
ignoreConcurrentModifications
in interface Locator<E>
ignoreConcurrentModifications
in class AbstractCollection.AbstractLocator<E>
ignore
- a boolean flag indicating if concurrent modification exceptions
should be disabledpublic void ignorePriorConcurrentModifications()
AbstractCollection.AbstractLocator
ignorePriorConcurrentModifications
in interface Locator<E>
ignorePriorConcurrentModifications
in class AbstractCollection.AbstractLocator<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |