etomica.atom.iterator
Class AtomIteratorAllLeafType

java.lang.Object
  extended by etomica.atom.iterator.AtomIteratorAllLeafType
All Implemented Interfaces:
AtomLeafsetIterator, AtomsetIterator, AtomsetIteratorBoxDependent, AtomsetIteratorDirectable, AtomsetIteratorTargetable, Serializable

public class AtomIteratorAllLeafType
extends Object
implements AtomsetIteratorBoxDependent, AtomsetIteratorDirectable, AtomsetIteratorTargetable, Serializable

Iterator for all the molecules of a set of species in a box. Each iterate is all the molecules in a box, with each Atom as the first atom in the set. This class is used by PotentialMaster to iterate over molecules for N-body potentials. This class is designed to work and conform to the API... not to be efficient or pleasant to look at! Use neighbor lists.

See Also:
Serialized Form

Constructor Summary
AtomIteratorAllLeafType(IAtomType[] atomType)
           
 
Method Summary
 int nBody()
          Returns the number of atoms given in each iterate, i.e., the size of the atom array returned with each call to next().
 IAtomList next()
          Returns the next AtomSet iterate, or null if hasNext() is false.
 void reset()
          Resets the iterator to loop through its iterates again.
 void setBox(IBox newBox)
          Sets the box containing the molecules for iteration.
 void setDirection(IteratorDirective.Direction newDirection)
          Has no effect, but is included as part of the AtomsetIteratorPDT interface.
 void setTarget(IAtom newTargetAtom)
          Sets the target of iteration...
 int size()
          Returns the number of iterates given by this iterator, if iterated after a call to reset().
 void unset()
          Puts iterator in a state in which hasNext() returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomIteratorAllLeafType

public AtomIteratorAllLeafType(IAtomType[] atomType)
Parameters:
species - species for which molecules are returned as iterates. Only species[0] is relevant, and must not be null.
Method Detail

setBox

public void setBox(IBox newBox)
Sets the box containing the molecules for iteration. A null box conditions iterator to give no iterates.

Specified by:
setBox in interface AtomsetIteratorBoxDependent

setTarget

public void setTarget(IAtom newTargetAtom)
Sets the target of iteration... has no actual effect since all iterates contain all Atoms.

Specified by:
setTarget in interface AtomsetIteratorTargetable

setDirection

public void setDirection(IteratorDirective.Direction newDirection)
Has no effect, but is included as part of the AtomsetIteratorPDT interface. Besides, you didn't really want to iterate down, did you?

Specified by:
setDirection in interface AtomsetIteratorDirectable

reset

public void reset()
Description copied from interface: AtomsetIterator
Resets the iterator to loop through its iterates again.

Specified by:
reset in interface AtomsetIterator

unset

public void unset()
Description copied from interface: AtomsetIterator
Puts iterator in a state in which hasNext() returns false.

Specified by:
unset in interface AtomsetIterator

next

public IAtomList next()
Description copied from interface: AtomLeafsetIterator
Returns the next AtomSet iterate, or null if hasNext() is false.

Specified by:
next in interface AtomLeafsetIterator

nBody

public int nBody()
Description copied from interface: AtomsetIterator
Returns the number of atoms given in each iterate, i.e., the size of the atom array returned with each call to next().

Specified by:
nBody in interface AtomsetIterator
Returns:

size

public int size()
Returns the number of iterates given by this iterator, if iterated after a call to reset().

Specified by:
size in interface AtomsetIterator