goldman.collection.set
Class DirectAddressing.Marker

java.lang.Object
  extended by goldman.collection.AbstractCollection.AbstractLocator<E>
      extended by goldman.collection.set.DirectAddressing.Marker
All Implemented Interfaces:
Locator<E>, Cloneable, Iterator<E>
Enclosing class:
DirectAddressing<E>

protected class DirectAddressing.Marker
extends AbstractCollection.AbstractLocator<E>
implements Locator<E>


Field Summary
 
Fields inherited from class goldman.collection.AbstractCollection.AbstractLocator
versionNumber
 
Method Summary
 boolean advance()
          Moves the marker to the next slot in use
 E get()
          Returns the element associated with this locator.
 boolean hasNext()
           
 boolean inCollection()
          This method also updates slot so that it is either FORE, AFT, or a valid slot that is in use.
 void remove()
          Removes the element at the marker, and updates the marker to be at the element in the iteration order that preceded the one removed.
 boolean retreat()
          Moves the marker to the previous slot in use, or to FORE if there is no such slot.
 
Methods inherited from class goldman.collection.AbstractCollection.AbstractLocator
checkValidity, ignoreConcurrentModifications, ignorePriorConcurrentModifications, next, updateVersion
 
Methods inherited from class java.lang.Object
clone, equals, 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
 

Method Detail

inCollection

public boolean inCollection()
                     throws ConcurrentModificationException
This method also updates slot so that it is either FORE, AFT, or a valid slot that is in use.

Specified by:
inCollection in interface Locator<E>
Returns:
true if and only if the marker is at an element of the collection
Throws:
ConcurrentModificationException

get

public E get()
      throws ConcurrentModificationException
Description copied from interface: Locator
Returns the element associated with this locator. When a tracker is used, the element associated with the locator might no longer be in the collection. If desired, the 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.

Specified by:
get in interface Locator<E>
Returns:
the element stored at the marker location.
Throws:
NoSuchElementException - the marker is logically at FORE or AFT.
ConcurrentModificationException

advance

public boolean advance()
                throws ConcurrentModificationException
Moves the marker to the next slot in use

Specified by:
advance in interface Locator<E>
Returns:
true if and only if there is an element at the updated marker location.
Throws:
AtBoundaryException - the marker is at AFT since there is no place to advance.
ConcurrentModificationException

retreat

public boolean retreat()
                throws ConcurrentModificationException
Moves the marker to the previous slot in use, or to FORE if there is no such slot.

Specified by:
retreat in interface Locator<E>
Returns:
true if and only if it retreats to an inuse slot.
Throws:
AtBoundaryException - the marker is already at FORE since then there is no place to retreat.
ConcurrentModificationException

hasNext

public boolean hasNext()
                throws ConcurrentModificationException
Specified by:
hasNext in interface Iterator<E>
Returns:
true if there is some element after the current marker location.
Throws:
ConcurrentModificationException

remove

public void remove()
            throws ConcurrentModificationException
Removes the element at the marker, and updates the marker to be at the element in the iteration order that preceded the one removed.

Specified by:
remove in interface Iterator<E>
Throws:
NoSuchElementException - the marker is logically at FORE or AFT
ConcurrentModificationException