etomica.atom.iterator
Class AtomIteratorBasis

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

public class AtomIteratorBasis
extends AtomIteratorArrayListSimple
implements AtomsetIteratorBasisDependent

Elementary basis-dependent iterator that gives atoms meeting specification of a basis and a target. Iterates are determined as follows:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class etomica.atom.iterator.AtomIteratorArrayListSimple
atomSetSinglet, cursor, list
 
Constructor Summary
AtomIteratorBasis()
          Constructor makes iterator in an unset condition; must set basis and call reset before beginning iteration.
 
Method Summary
 int basisSize()
          Returns 1, indicating that only a single-atom basis is appropriate.
 boolean haveTarget(IAtom target)
          Returns true if the given target with the present basis could yield an iterate.
 void reset()
          Puts iterator in a state ready to begin iteration.
 void setBasis(IMoleculeList atoms)
          Sets the basis for iteration, such that the childList atoms of the given atom will be subject to iteration (within any specifications given by a prior or subsequent call to setTarget).
 void setTarget(IAtom newTargetAtom)
          Method to specify a target atom.
 
Methods inherited from class etomica.atom.iterator.AtomIteratorArrayListSimple
nBody, next, nextAtom, setList, size, unset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface etomica.atom.iterator.AtomLeafsetIterator
next
 
Methods inherited from interface etomica.atom.iterator.AtomsetIterator
nBody, size, unset
 

Constructor Detail

AtomIteratorBasis

public AtomIteratorBasis()
Constructor makes iterator in an unset condition; must set basis and call reset before beginning iteration.

Method Detail

setTarget

public void setTarget(IAtom newTargetAtom)
Method to specify a target atom. Specifying a zero-length AtomSet or a length-1 AtomSet with a null atom releases any target restrictions, and specifies that the iterator should give all of the basis-set atoms. Call to this method leaves iterator unset; call to reset is required before beginning iteration.

Specified by:
setTarget in interface AtomsetIteratorTargetable

setBasis

public void setBasis(IMoleculeList atoms)
Sets the basis for iteration, such that the childList atoms of the given atom will be subject to iteration (within any specifications given by a prior or subsequent call to setTarget). If given atom is a leaf, it will itself be the sole candidate iterate given by the iterator. If argument is null or otherwise does not specify an atom, iterator will be conditioned to give no iterates until a new basis is specified. The given AtomSet, if not null, must have a size of 1.

Specified by:
setBasis in interface AtomsetIteratorBasisDependent
Parameters:
atoms - The basis atoms; a null basis will condition the iterator to give no iterates until a valid basis is specified via another call to this method.
Throws:
IllegalArgumentException - if atoms.count() is not 0 or 1

haveTarget

public boolean haveTarget(IAtom target)
Returns true if the given target with the present basis could yield an iterate. Assumes that the basis -- if it is a group -- has child atoms.

Specified by:
haveTarget in interface AtomsetIteratorBasisDependent

reset

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

Specified by:
reset in interface AtomsetIterator
Overrides:
reset in class AtomIteratorArrayListSimple

basisSize

public int basisSize()
Returns 1, indicating that only a single-atom basis is appropriate.

Specified by:
basisSize in interface AtomsetIteratorBasisDependent
Returns:
the size of the basis for this iterator.