etomica.atom
Class Atom

java.lang.Object
  extended by etomica.atom.Atom
All Implemented Interfaces:
IAtom, Serializable
Direct Known Subclasses:
AtomLeafDynamic, AtomOriented

public class Atom
extends Object
implements IAtom, Serializable

Atom that represents a physical atom with a position.

See Also:
Serialized Form

Field Summary
protected  int index
           
protected  int leafIndex
           
protected  IMolecule parent
           
protected  IVectorMutable position
           
protected  IAtomType type
           
 
Constructor Summary
Atom(ISpace space)
          Makes a simple atom for the given space.
Atom(ISpace space, IAtomType type)
           
 
Method Summary
 int getIndex()
          Returns this IAtom's index, which is its place in the parent AtomGroup's list of child IAtoms.
 int getLeafIndex()
          Returns the global index (within the Box) of this Atom.
 IMolecule getParentGroup()
          Returns the parent AtomGruop of this IAtom.
 IVectorMutable getPosition()
          Returns the position of the IAtom.
 IAtomType getType()
           
 void setIndex(int newIndex)
          Informs the IAtom of its index, which is used to construct the address.
 void setLeafIndex(int newLeafIndex)
          Sets the atom's global index to the give value.
 void setParent(IMolecule newParent)
          Informs the Atom that the given AtomGroup is its parent.
 String signature()
          Returns a string of digits that uniquely identifies this atom.
 String toString()
          Returns a string formed by concatenating the signature of this atom to a string that identifies it as a species master, species agent, molecule, group, or (leaf) atom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected final IAtomType type

index

protected int index

position

protected final IVectorMutable position

parent

protected IMolecule parent

leafIndex

protected int leafIndex
Constructor Detail

Atom

public Atom(ISpace space,
            IAtomType type)

Atom

public Atom(ISpace space)
Makes a simple atom for the given space. Coordinate is non-kinetic sphere; node is for a leaf atom; type is a sphere with unit mass and unit size, unique to the new atom; depth is 0.

Method Detail

signature

public String signature()
Returns a string of digits that uniquely identifies this atom. String is formed by concatenating the ordinal of this atom to the signature given by the parent of this atom. If atom has no parent, forms a string from only the ordinal.


toString

public final String toString()
Returns a string formed by concatenating the signature of this atom to a string that identifies it as a species master, species agent, molecule, group, or (leaf) atom.

Overrides:
toString in class Object

setIndex

public final void setIndex(int newIndex)
Description copied from interface: IAtom
Informs the IAtom of its index, which is used to construct the address.

Specified by:
setIndex in interface IAtom

getIndex

public final int getIndex()
Description copied from interface: IAtom
Returns this IAtom's index, which is its place in the parent AtomGroup's list of child IAtoms.

Specified by:
getIndex in interface IAtom

setParent

public void setParent(IMolecule newParent)
Informs the Atom that the given AtomGroup is its parent. This method should only be called by the parent.

Specified by:
setParent in interface IAtom

getParentGroup

public IMolecule getParentGroup()
Description copied from interface: IAtom
Returns the parent AtomGruop of this IAtom.

Specified by:
getParentGroup in interface IAtom

getPosition

public IVectorMutable getPosition()
Description copied from interface: IAtom
Returns the position of the IAtom. Modifying the returned IVector will alter the IAtom's position.

Specified by:
getPosition in interface IAtom

getLeafIndex

public int getLeafIndex()
Description copied from interface: IAtom
Returns the global index (within the Box) of this Atom. The global index is unique to the IAtom in the Box. The IAtom's global may change over the course of a simulation due to addition or removal of other IAtoms in the Box. An BoxGlobalAtomIndexEvent is fired by the Box's event manager when an Atom's global index changes.

Specified by:
getLeafIndex in interface IAtom

setLeafIndex

public void setLeafIndex(int newLeafIndex)
Description copied from interface: IAtom
Sets the atom's global index to the give value. This method should only be called by the IBox.

Specified by:
setLeafIndex in interface IAtom

getType

public final IAtomType getType()
Specified by:
getType in interface IAtom
Returns:
the Atom type, holding properties held in common with other atoms made by this atom's factory.