etomica.atom
Class AtomListWrapper

java.lang.Object
  extended by etomica.atom.AtomListWrapper
All Implemented Interfaces:
IAtomList, Serializable

public class AtomListWrapper
extends Object
implements IAtomList, Serializable

AtomSet formed by wrapping an AtomArrayList. ArrayList can be

See Also:
Serialized Form

Constructor Summary
AtomListWrapper()
          Wraps a new atom array of the given length.
AtomListWrapper(AtomArrayList atoms)
          Wraps the given atom array.
AtomListWrapper(IAtomList atomSet)
          Makes a new instance holding the atoms in the given atom set.
 
Method Summary
 AtomArrayList getArrayList()
           
 IAtom getAtom(int i)
          Part of implementation of AtomSet interface.
 int getAtomCount()
          Returns the length of the wrapped array.
 void setAtoms(IAtomList atomSet)
          Copies the atoms in the given atom set to the wrapped array of atoms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomListWrapper

public AtomListWrapper()
Wraps a new atom array of the given length.


AtomListWrapper

public AtomListWrapper(IAtomList atomSet)
Makes a new instance holding the atoms in the given atom set. Makes zero-body AtomSet if argument is null.


AtomListWrapper

public AtomListWrapper(AtomArrayList atoms)
Wraps the given atom array. Subsequent call to getArray will return the array instance given here.

Method Detail

getAtom

public IAtom getAtom(int i)
Part of implementation of AtomSet interface.

Specified by:
getAtom in interface IAtomList

getArrayList

public AtomArrayList getArrayList()
Returns:
the wrapped array of atoms, which is declared final in the class.

setAtoms

public void setAtoms(IAtomList atomSet)
Copies the atoms in the given atom set to the wrapped array of atoms.

Throws:
IllegalArgumentException - if length of array is not equal to count field of this instance.
NullPointerException - if argument is null

getAtomCount

public int getAtomCount()
Returns the length of the wrapped array.

Specified by:
getAtomCount in interface IAtomList
Returns:
the number of atoms in the set