etomica.atom.iterator
Class AtomIteratorArrayListSimple

java.lang.Object
  extended by etomica.atom.iterator.AtomIteratorArrayListSimple
All Implemented Interfaces:
AtomIterator, AtomLeafsetIterator, AtomsetIterator, Serializable
Direct Known Subclasses:
AtomIteratorArrayList, AtomIteratorBasis, AtomIteratorLeafAtoms

public class AtomIteratorArrayListSimple
extends Object
implements AtomIterator, Serializable

An atom iterator of the elements from an AtomArrayList (in proper sequence). Iterator will fail if element are added to or removed from list while iteration is proceeding.

See Also:
Serialized Form

Field Summary
protected  AtomSetSinglet atomSetSinglet
           
protected  int cursor
          Index of element to be returned by subsequent call to next.
protected  IAtomList list
           
 
Constructor Summary
AtomIteratorArrayListSimple()
          Constructs new iterator with an empty list.
AtomIteratorArrayListSimple(IAtomList atomList)
          Constructs new iterator set to iterate given list (upon reset).
 
Method Summary
 int nBody()
          Returns 1, indicating that this is an atom iterator.
 IAtomList next()
          Same as nextAtom().
 IAtom nextAtom()
          Returns the next iterate and advances the iterator.
 void reset()
          Puts iterator in state ready to begin iteration.
 void setList(IAtomList atomList)
          Sets the list for iteration.
 int size()
          Returns the number of iterates that would be given by this iterator if reset with the current list.
 void unset()
          Puts iterator in state in which hasNext is false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cursor

protected int cursor
Index of element to be returned by subsequent call to next.


list

protected IAtomList list

atomSetSinglet

protected final AtomSetSinglet atomSetSinglet
Constructor Detail

AtomIteratorArrayListSimple

public AtomIteratorArrayListSimple()
Constructs new iterator with an empty list.


AtomIteratorArrayListSimple

public AtomIteratorArrayListSimple(IAtomList atomList)
Constructs new iterator set to iterate given list (upon reset).

Method Detail

setList

public void setList(IAtomList atomList)
Sets the list for iteration. Null value will result in a NullPointerException.


nBody

public int nBody()
Returns 1, indicating that this is an atom iterator.

Specified by:
nBody in interface AtomsetIterator
Returns:

unset

public void unset()
Puts iterator in state in which hasNext is false.

Specified by:
unset in interface AtomsetIterator

nextAtom

public IAtom nextAtom()
Returns the next iterate and advances the iterator.

Specified by:
nextAtom in interface AtomIterator

next

public IAtomList next()
Same as nextAtom().

Specified by:
next in interface AtomLeafsetIterator

size

public int size()
Returns the number of iterates that would be given by this iterator if reset with the current list.

Specified by:
size in interface AtomsetIterator

reset

public void reset()
Puts iterator in state ready to begin iteration.

Specified by:
reset in interface AtomsetIterator