etomica.atom.iterator
Class ApiIntragroup

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

public final class ApiIntragroup
extends Object
implements AtomsetIteratorBasisDependent, AtomsetIteratorDirectable, Serializable

Returns iterates from the childList of a single basis atom. Behavior is set via iterator directive: if no atom is specified there, all pairs formed from the childList are given; otherwise, if an atom is specified there, pairs will be formed from the childList atoms with the basis' child from which the target atom is descended.

See Also:
Serialized Form

Constructor Summary
ApiIntragroup()
          Constructor makes iterator that must have basis specified and then be reset() before iteration.
ApiIntragroup(AtomIteratorAtomDependent aiInnerUp, AtomIteratorAtomDependent aiInnerDn)
           
ApiIntragroup(AtomsetIteratorBasisDependent aiOuter, AtomIteratorAtomDependent aiInnerUp, AtomIteratorAtomDependent aiInnerDn)
           
 
Method Summary
 int basisSize()
          Returns 1, indicating the the array given to the setBasis method should have only one element.
 boolean haveTarget(IAtom target)
          Returns true if the iterator with its current basis would return an iterate for the given target.
 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()
          Puts iterator in a state to begin iteration.
 void setBasis(IMoleculeList atoms)
          Specifies the parent atom of the iterates.
 void setDirection(IteratorDirective.Direction direction)
          Specifies the direction, which applies only if iterating pairs with a target atom; otherwise, if all pairs from group are indicated, direction is ignored.
 void setTarget(IAtom newTargetAtom)
           
 int size()
          Returns the number of atom pairs the iterator will return if reset and iterated in its present state.
 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

ApiIntragroup

public ApiIntragroup()
Constructor makes iterator that must have basis specified and then be reset() before iteration.


ApiIntragroup

public ApiIntragroup(AtomIteratorAtomDependent aiInnerUp,
                     AtomIteratorAtomDependent aiInnerDn)

ApiIntragroup

public ApiIntragroup(AtomsetIteratorBasisDependent aiOuter,
                     AtomIteratorAtomDependent aiInnerUp,
                     AtomIteratorAtomDependent aiInnerDn)
Method Detail

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:

setTarget

public void setTarget(IAtom newTargetAtom)
Specified by:
setTarget in interface AtomsetIteratorTargetable

haveTarget

public boolean haveTarget(IAtom target)
Description copied from interface: AtomsetIteratorBasisDependent
Returns true if the iterator with its current basis would return an iterate for the given target.

Specified by:
haveTarget in interface AtomsetIteratorBasisDependent

reset

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

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

setBasis

public void setBasis(IMoleculeList atoms)
Specifies the parent atom of the iterates. Pairs given by the iterator will be formed from the childList of the first atom in the given array. If argument is null or otherwise does not specify a childList, iterator will not return iterates (hasNext false) until a valid basis is specified. Length of given array should match the value returned by setBasis, but if it is greater no error results; only first atom in array is used.

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.

setDirection

public void setDirection(IteratorDirective.Direction direction)
Specifies the direction, which applies only if iterating pairs with a target atom; otherwise, if all pairs from group are indicated, direction is ignored.

Specified by:
setDirection in interface AtomsetIteratorDirectable

size

public int size()
Returns the number of atom pairs the iterator will return if reset and iterated in its present state.

Specified by:
size 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

basisSize

public int basisSize()
Returns 1, indicating the the array given to the setBasis method should have only one element.

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