etomica.atom
Class AtomsetArray

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

public class AtomsetArray
extends Object
implements IAtomList, Serializable

AtomSet formed by wrapping an Atom array. Size of array cannot be changed after construction.

See Also:
Serialized Form

Constructor Summary
AtomsetArray(AtomsetArray atomSet)
          Copy constructor, wrapping a new array unique to this instance but holding the same atoms as the given atom set.
AtomsetArray(IAtom[] atoms)
          Wraps the given atom array.
AtomsetArray(IAtomList atomSet)
          Makes a new instance holding the atoms in the given atom set.
AtomsetArray(int nAtoms)
          Wraps a new atom array of the given length.
 
Method Summary
 IAtom[] getArray()
           
 IAtom getAtom(int i)
          Part of implementation of AtomSet interface.
 int getAtomCount()
          Returns the length of the wrapped array.
 void setAtoms(IAtom[] newAtoms)
          Copies the atoms in the given array to the wrapped, final array of atoms.
 void setAtoms(IAtomList atomSet)
          Copies the atoms in the given atom set to the wrapped array of atoms.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomsetArray

public AtomsetArray(int nAtoms)
Wraps a new atom array of the given length.


AtomsetArray

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


AtomsetArray

public AtomsetArray(AtomsetArray atomSet)
Copy constructor, wrapping a new array unique to this instance but holding the same atoms as the given atom set.

Throws:
NullPointerException - if argument is null

AtomsetArray

public AtomsetArray(IAtom[] 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

getArray

public IAtom[] getArray()
Returns:
the wrapped array of atoms, which is declared final in the class.

setAtoms

public void setAtoms(IAtom[] newAtoms)
Copies the atoms in the given array to the wrapped, final array of atoms.

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

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

toString

public String toString()
Overrides:
toString in class Object