etomica.atom.iterator
Class AtomIteratorArrayListAdjacent

java.lang.Object
  extended by etomica.atom.iterator.AtomIteratorArrayListAdjacent
All Implemented Interfaces:
AtomIterator, AtomIteratorAtomDependent, AtomLeafsetIterator, AtomsetIterator, Serializable

public class AtomIteratorArrayListAdjacent
extends Object
implements AtomIteratorAtomDependent, Serializable

Returns one or both of the atoms adjacent to a specified atom in its parent's child list. If adjacent linker has no atom no corresponding atom is given as an iterate; thus iterator may give 0, 1, or 2 iterates depending on presence of adjacent atoms and specification of iteration direction.

See Also:
Serialized Form

Field Summary
protected  AtomSetSinglet atomSetSinglet
           
 
Constructor Summary
AtomIteratorArrayListAdjacent(IteratorDirective.Direction direction)
          Constructor gives iterator not ready for iteration.
AtomIteratorArrayListAdjacent(IteratorDirective.Direction direction, AtomToIndex atomToIndex, AtomToAtomLeafList atomToAtomSet)
           
 
Method Summary
 int nBody()
          Returns 1, indicating that this is an atom AtomSet iterator.
 IAtomList next()
          Same as nextAtom.
 IAtom nextAtom()
          Returns the next iterator, or null if hasNext is false.
 void reset()
          Readies the iterator to begin iteration.
 void setAtom(IAtom atom)
          Sets the first atom for iteration.
 int size()
          Returns the number of iterates that iterator would give if reset and iterated in its current condition.
 void unset()
          Puts iterator in a state where hasNext is false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atomSetSinglet

protected final AtomSetSinglet atomSetSinglet
Constructor Detail

AtomIteratorArrayListAdjacent

public AtomIteratorArrayListAdjacent(IteratorDirective.Direction direction)
Constructor gives iterator not ready for iteration. Must set an atom and reset before using. Default direction is null, meaning that both adjacent atoms (if there are two) will be given by iterator.


AtomIteratorArrayListAdjacent

public AtomIteratorArrayListAdjacent(IteratorDirective.Direction direction,
                                     AtomToIndex atomToIndex,
                                     AtomToAtomLeafList atomToAtomSet)
Method Detail

size

public int size()
Returns the number of iterates that iterator would give if reset and iterated in its current condition. Does not depend on or affect iteration state.

Specified by:
size in interface AtomsetIterator

nBody

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

Specified by:
nBody in interface AtomsetIterator
Returns:

next

public IAtomList next()
Same as nextAtom.

Specified by:
next in interface AtomLeafsetIterator

nextAtom

public IAtom nextAtom()
Returns the next iterator, or null if hasNext is false.

Specified by:
nextAtom in interface AtomIterator

reset

public void reset()
Readies the iterator to begin iteration.

Specified by:
reset in interface AtomsetIterator

unset

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

Specified by:
unset in interface AtomsetIterator

setAtom

public void setAtom(IAtom atom)
Sets the first atom for iteration. Iteration proceeds from this atom up and/or down the list, depending on how iterator was configured at construction.

Specified by:
setAtom in interface AtomIteratorAtomDependent