The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Interface AtomCollection

All Known Subinterfaces:
AtomGraph, BondingSystem, GammaSequence, Molecule
All Known Implementing Classes:
AtomGraphDecorator, BasicAtomCollection, BasicAtomGraph, BasicBondingSystem, BasicGammaSequence, MoleculeDecorator, SimpleBondingSystem

public interface AtomCollection

AtomCollection represents an immutable group of Atoms. Any Atom may be present, but null is disallowed. Atoms from different Molecules may or not be present, depending on implementation.

AtomCollection places the additional restriction on implementors that all methods are consistent - they can be assumed to return the same results throughout the lifetime of the AtomCollection.

Author:
Richard Apodaca
See Also:
"Immutable Pattern (Grand98)"

Method Summary
 boolean containsAtom(Atom atom)
          Returns true if the specified Atom is contained in this collection, and false otherwise.
 int countAtoms()
          Returns the number of Atoms contained in this atom collection.
 Atom getAtom(int index)
          Returns the Atom located at the specified zero-based index.
 int getAtomIndex(Atom atom)
          Returns the zero-based index of the specified Atom.
 AtomIterator iterateAtoms()
          Returns an iterator over all Atoms in this collection.
 Atom[] toAtomArray()
          Returns a copy of the Atoms contained in this collection as an array.
 

Method Detail

containsAtom

public boolean containsAtom(Atom atom)
Returns true if the specified Atom is contained in this collection, and false otherwise.

Parameters:
atom - the Atom
Returns:
true if contained, false otherwise

countAtoms

public int countAtoms()
Returns the number of Atoms contained in this atom collection.

Returns:
the number of atoms in this collection

getAtomIndex

public int getAtomIndex(Atom atom)
Returns the zero-based index of the specified Atom.

Parameters:
atom - the atom
Returns:
the index of the atom, or -1 if this collection does not contain atom

getAtom

public Atom getAtom(int index)
Returns the Atom located at the specified zero-based index.

Parameters:
index - the index
Returns:
the Atom at index, or null if the index is invalid
Throws:
java.lang.IndexOutOfBoundsException - if index is less than zero or greater than or equal to the number of Atoms

iterateAtoms

public AtomIterator iterateAtoms()
Returns an iterator over all Atoms in this collection.

Returns:
an iterator over all Atoms in this collection

toAtomArray

public Atom[] toAtomArray()
Returns a copy of the Atoms contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Returns:
a copy of the Atom array for this collection

The Octet Molecular Representation Framework v0.8.2