etomica.atom.iterator
Class ApiIntraArrayList

java.lang.Object
  extended by etomica.atom.iterator.ApiIntraArrayList
All Implemented Interfaces:
AtomLeafsetIterator, AtomsetIterator, Serializable
Direct Known Subclasses:
ApiLeafAtoms

public class ApiIntraArrayList
extends Object
implements AtomLeafsetIterator, Serializable

Returns all pairs formed from a single list of atoms.

See Also:
Serialized Form

Constructor Summary
ApiIntraArrayList()
          Construct iterator with an empty list.
ApiIntraArrayList(IAtomList list)
          Constructs iterator to return pairs from the given list.
 
Method Summary
 IAtomList getList()
          Returns the list used to generate the pairs.
 int nBody()
          Returns 2, indicating that this is a pair iterator
 IAtomList next()
          Returns the next iterate pair.
 void reset()
          Sets iterator in condition to begin iteration.
 void setList(IAtomList newList)
          Sets the list that will be used to generate the pairs.
 int size()
          Returns the number of iterates, which is list.size*(list.size-1)/2
 void unset()
          Sets iterator such that next is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApiIntraArrayList

public ApiIntraArrayList()
Construct iterator with an empty list. No iterates will be given until a non-empty list is specified via setList.


ApiIntraArrayList

public ApiIntraArrayList(IAtomList list)
Constructs iterator to return pairs from the given list. Requires reset() before first use.

Parameters:
list -
Method Detail

reset

public void reset()
Sets iterator in condition to begin iteration.

Specified by:
reset in interface AtomsetIterator

unset

public void unset()
Sets iterator such that next is null.

Specified by:
unset in interface AtomsetIterator

size

public int size()
Returns the number of iterates, which is list.size*(list.size-1)/2

Specified by:
size in interface AtomsetIterator

next

public IAtomList next()
Returns the next iterate pair. Returns null if hasNext() is false.

Specified by:
next in interface AtomLeafsetIterator

nBody

public int nBody()
Returns 2, indicating that this is a pair iterator

Specified by:
nBody in interface AtomsetIterator
Returns:

setList

public void setList(IAtomList newList)
Sets the list that will be used to generate the pairs. Must call reset() before beginning iteration.

Parameters:
atomList - the new atom list for iteration

getList

public IAtomList getList()
Returns the list used to generate the pairs.