The Octet Molecular Representation Framework v0.8.2

net.sf.octet.model
Class MoleculeDecorator

java.lang.Object
  extended bynet.sf.octet.model.MoleculeDecorator
All Implemented Interfaces:
AtomCollection, AtomGraph, AtomPairCollection, BondingSystemCollection, Molecule

public abstract class MoleculeDecorator
extends java.lang.Object
implements Molecule

MoleculeDecorator forwards all requests to a Molecule that it decorates. This design follows the "Decorator Pattern" which, among other consequences, enables responsibilities to be dynamically assigned and revoked to Molecules at run-time. Subclassing MoleculeDecorator provides a conventient way to implement this concept.

Author:
Richard Apodaca
See Also:
"Decorator Pattern (GoF95)"

Constructor Summary
protected MoleculeDecorator(Molecule molecule)
          Constructs a MoleculeDecorator that will decorate the specified Molecule.
 
Method Summary
 boolean containsAtom(Atom atom)
          Returns true if the specified Atom is contained in this collection, and false otherwise.
 boolean containsAtomPair(Atom source, Atom target)
          Returns true if an AtomPair connecting source and target is contained in this collection.
 boolean containsAtomPair(AtomPair pair)
          Returns true if an AtomPair matching pair is contained in this collection.
 boolean containsBondingSystem(BondingSystem system)
          Returns true if a BondingSystem matching system is contained in this collection.
 int countAtomPairs()
          Returns the number of AtomPairs contained in this collection.
 int countAtoms()
          Returns the number of Atoms contained in this atom collection.
 int countBondingSystems()
          Returns the number of BondingSystems contained in this collection.
 int countBondingSystems(Atom atom)
          Returns the number of BondingSystems in which the specified Atom particpates.
 int countImplicitHydrogens(Atom atom)
          Returns the number of implicit hydrogens associated with atom.
 int countNeighbors(Atom atom)
          Returns the number of Atoms connected to atom in the context of this AtomGraph.
 int countNonbondingValenceElectrons(Atom atom)
          Returns the total number of nonbonding valence electrons associeated with atom.
 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.
 AtomPair getAtomPair(Atom source, Atom target)
          Returns an AtomPair containing the specified source and target Atoms.
 AtomPair getAtomPair(int index)
          Returns the AtomPair corresponding to the specified integer index.
 int getAtomPairIndex(AtomPair pair)
          Returns the index of the specified AtomPair.
 BondingSystem getBondingSystem(int index)
          Returns the BondingSystem located at the specified zero-based index.
 int getBondingSystemIndex(BondingSystem system)
          Returns the zero-based index of the specified BondingSystem.
 Configuration getConfiguration(Atom atom)
          Returns the Configuration of the specified Atom.
 Conformation getConformation()
          Returns the Conformation of this Molecule.
 NonbondingShell getNonbondingShell(Atom atom)
          Returns the NonbondingShell of the specified Atom.
 AtomPairIterator iterateAtomPairs()
          Returns an iterator over all AtomPairs in this collection.
 AtomIterator iterateAtoms()
          Returns an iterator over all Atoms in this collection.
 BondingSystemIterator iterateBondingSystems()
          Returns an iterator over all BondingSystems in this collection.
 BondingSystemIterator iterateBondingSystems(Atom atom)
          Returns an iterator over all BondingSystems in which the specified Atom participates.
 AtomIterator iterateNeighbors(Atom atom)
          Returns an iterator over all neighbors of atom in the context of this AtomGraph.
 Atom[] toAtomArray()
          Returns a copy of the Atoms contained in this collection as an array.
 AtomPair[] toAtomPairArray()
          Returns a copy of the atom pairs contained in this collection as an array.
 BondingSystem[] toBondingSystemArray()
          Returns a copy of the bonding systems contained in this collection as an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoleculeDecorator

protected MoleculeDecorator(Molecule molecule)
Constructs a MoleculeDecorator that will decorate the specified Molecule.

Method Detail

containsAtom

public boolean containsAtom(Atom atom)
Description copied from interface: AtomCollection
Returns true if the specified Atom is contained in this collection, and false otherwise.

Specified by:
containsAtom in interface AtomCollection
Parameters:
atom - the Atom
Returns:
true if contained, false otherwise

countAtoms

public int countAtoms()
Description copied from interface: AtomCollection
Returns the number of Atoms contained in this atom collection.

Specified by:
countAtoms in interface AtomCollection
Returns:
the number of atoms in this collection

iterateAtoms

public AtomIterator iterateAtoms()
Description copied from interface: AtomCollection
Returns an iterator over all Atoms in this collection.

Specified by:
iterateAtoms in interface AtomCollection
Returns:
an iterator over all Atoms in this collection

containsBondingSystem

public boolean containsBondingSystem(BondingSystem system)
Description copied from interface: BondingSystemCollection
Returns true if a BondingSystem matching system is contained in this collection.

Specified by:
containsBondingSystem in interface BondingSystemCollection
Parameters:
system - the BondingSystem to search for
Returns:
true if found, false otherwise

countBondingSystems

public int countBondingSystems()
Description copied from interface: BondingSystemCollection
Returns the number of BondingSystems contained in this collection.

Specified by:
countBondingSystems in interface BondingSystemCollection
Returns:
the number of BondingSystems contained in this collection.

iterateBondingSystems

public BondingSystemIterator iterateBondingSystems()
Description copied from interface: BondingSystemCollection
Returns an iterator over all BondingSystems in this collection.

Specified by:
iterateBondingSystems in interface BondingSystemCollection
Returns:
an iterator over all BondingSystems in this collection

containsAtomPair

public boolean containsAtomPair(AtomPair pair)
Description copied from interface: AtomPairCollection
Returns true if an AtomPair matching pair is contained in this collection.

Specified by:
containsAtomPair in interface AtomPairCollection
Parameters:
pair - the AtomPair to search for
Returns:
true if found, false otherwise

containsAtomPair

public boolean containsAtomPair(Atom source,
                                Atom target)
Description copied from interface: AtomPairCollection
Returns true if an AtomPair connecting source and target is contained in this collection.

Specified by:
containsAtomPair in interface AtomPairCollection
Parameters:
source - the source atom
target - the target atom
Returns:
true if the atom pair exists, false otherwise

getAtomPair

public AtomPair getAtomPair(Atom source,
                            Atom target)
Description copied from interface: AtomPairCollection
Returns an AtomPair containing the specified source and target Atoms. If no such pair is found, null is returned.

Specified by:
getAtomPair in interface AtomPairCollection
Parameters:
source - the source atom
target - the target atom
Returns:
the matching AtomPair

countAtomPairs

public int countAtomPairs()
Description copied from interface: AtomPairCollection
Returns the number of AtomPairs contained in this collection.

Specified by:
countAtomPairs in interface AtomPairCollection
Returns:
the number of AtomPairs contained in this collection.

iterateAtomPairs

public AtomPairIterator iterateAtomPairs()
Description copied from interface: AtomPairCollection
Returns an iterator over all AtomPairs in this collection.

Specified by:
iterateAtomPairs in interface AtomPairCollection
Returns:
an iterator over all AtomPairs in this collection

getAtom

public Atom getAtom(int index)
Description copied from interface: AtomCollection
Returns the Atom located at the specified zero-based index.

Specified by:
getAtom in interface AtomCollection
Parameters:
index - the index
Returns:
the Atom at index, or null if the index is invalid

getAtomIndex

public int getAtomIndex(Atom atom)
Description copied from interface: AtomCollection
Returns the zero-based index of the specified Atom.

Specified by:
getAtomIndex in interface AtomCollection
Parameters:
atom - the atom
Returns:
the index of the atom, or -1 if this collection does not contain atom

getBondingSystemIndex

public int getBondingSystemIndex(BondingSystem system)
Description copied from interface: BondingSystemCollection
Returns the zero-based index of the specified BondingSystem.

Specified by:
getBondingSystemIndex in interface BondingSystemCollection
Parameters:
system - the BondingSystem
Returns:
the index of the BondingSystem, or -1 if this collection does not contain system

getAtomPair

public AtomPair getAtomPair(int index)
Description copied from interface: AtomPairCollection
Returns the AtomPair corresponding to the specified integer index.

Specified by:
getAtomPair in interface AtomPairCollection
Parameters:
index - the index to search for
Returns:
the AtomPair at the specified index

getAtomPairIndex

public int getAtomPairIndex(AtomPair pair)
Description copied from interface: AtomPairCollection
Returns the index of the specified AtomPair.

Specified by:
getAtomPairIndex in interface AtomPairCollection
Parameters:
pair - the AtomPair to search for
Returns:
the index of the AtomPair

toAtomArray

public Atom[] toAtomArray()
Description copied from interface: AtomCollection
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.

Specified by:
toAtomArray in interface AtomCollection
Returns:
a copy of the Atom array for this collection

toBondingSystemArray

public BondingSystem[] toBondingSystemArray()
Description copied from interface: BondingSystemCollection
Returns a copy of the bonding systems contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toBondingSystemArray in interface BondingSystemCollection
Returns:
a copy of the bonding system array for this collection

toAtomPairArray

public AtomPair[] toAtomPairArray()
Description copied from interface: AtomPairCollection
Returns a copy of the atom pairs contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toAtomPairArray in interface AtomPairCollection
Returns:
a copy of the atom pair array for this collection

countNeighbors

public int countNeighbors(Atom atom)
Description copied from interface: AtomGraph
Returns the number of Atoms connected to atom in the context of this AtomGraph. This value will be less than or equal to the value returned by atom.countNeighbors().

Specified by:
countNeighbors in interface AtomGraph
Parameters:
atom - the Atom to examine
Returns:
the number of neighbors of atom

iterateNeighbors

public AtomIterator iterateNeighbors(Atom atom)
Description copied from interface: AtomGraph
Returns an iterator over all neighbors of atom in the context of this AtomGraph. This iterator may contain only a subset of the Atoms returned by atom.iterateNeighbors(), depending on the nature of this AtomGraph.

Specified by:
iterateNeighbors in interface AtomGraph
Parameters:
atom - the Atom to examine
Returns:
an iterator over all neighbors of atom

countBondingSystems

public int countBondingSystems(Atom atom)
Description copied from interface: Molecule
Returns the number of BondingSystems in which the specified Atom particpates.

Specified by:
countBondingSystems in interface Molecule
Parameters:
atom - the Atom
Returns:
the number of BondingSystems in which the specified Atom particpates

countNonbondingValenceElectrons

public int countNonbondingValenceElectrons(Atom atom)
Description copied from interface: Molecule
Returns the total number of nonbonding valence electrons associeated with atom. This number includes any electrons contained in the NonbondingShell of atom.

Specified by:
countNonbondingValenceElectrons in interface Molecule
Parameters:
atom - the Atom
Returns:
the total number of nonbonding valence electrons associeated with atom

getConfiguration

public Configuration getConfiguration(Atom atom)
Description copied from interface: Molecule
Returns the Configuration of the specified Atom. Configuration refers to the spatial arrangement of neighboring Atoms around a central Atom that do not result from rotation about an AtomPair.

Specified by:
getConfiguration in interface Molecule
Returns:
the Configuration of this Atom

getConformation

public Conformation getConformation()
Description copied from interface: Molecule
Returns the Conformation of this Molecule.

Specified by:
getConformation in interface Molecule
Returns:
the Conformation of this Molecule

iterateBondingSystems

public BondingSystemIterator iterateBondingSystems(Atom atom)
Description copied from interface: Molecule
Returns an iterator over all BondingSystems in which the specified Atom participates.

Specified by:
iterateBondingSystems in interface Molecule
Parameters:
atom - the Atom
Returns:
an iterator over all BondingSystems in which the specified Atom participates

getNonbondingShell

public NonbondingShell getNonbondingShell(Atom atom)
Description copied from interface: Molecule
Returns the NonbondingShell of the specified Atom.

Specified by:
getNonbondingShell in interface Molecule
Parameters:
atom - the Atom
Returns:
the NonbondingShell of atom

countImplicitHydrogens

public int countImplicitHydrogens(Atom atom)
Description copied from interface: Molecule
Returns the number of implicit hydrogens associated with atom.

Specified by:
countImplicitHydrogens in interface Molecule
Parameters:
atom - the Atom
Returns:
the number of implicit hydrogens associated with atom

getBondingSystem

public BondingSystem getBondingSystem(int index)
Description copied from interface: BondingSystemCollection
Returns the BondingSystem located at the specified zero-based index.

Specified by:
getBondingSystem in interface BondingSystemCollection
Parameters:
index - the index
Returns:
the BondingSystem at index

The Octet Molecular Representation Framework v0.8.2