The Octet Molecular Representation Framework v0.8.2

net.sf.octet.model
Class AtomGraphDecorator

java.lang.Object
  extended bynet.sf.octet.model.AtomGraphDecorator
All Implemented Interfaces:
AtomCollection, AtomGraph, AtomPairCollection
Direct Known Subclasses:
BasicBondingSystem, BasicGammaSequence

public class AtomGraphDecorator
extends java.lang.Object
implements AtomGraph

A decorator for an AtomGraph. Use AtomGraphDecorator to dynamically add responsibilities to an AtomGraph at runtime, as an alternative to directly subclassing an AtomGraph implementation.

Author:
Richard Apodaca

Constructor Summary
protected AtomGraphDecorator(AtomGraph graph)
          Decorates graph.
 
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.
 int countAtomPairs()
          Returns the number of AtomPairs contained in this collection.
 int countAtoms()
          Returns the number of Atoms contained in this atom collection.
 int countNeighbors(Atom atom)
          Returns the number of Atoms connected to atom in the context of this AtomGraph.
 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.
 AtomPairIterator iterateAtomPairs()
          Returns an iterator over all AtomPairs in this collection.
 AtomIterator iterateAtoms()
          Returns an iterator over all Atoms in this collection.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomGraphDecorator

protected AtomGraphDecorator(AtomGraph graph)
Decorates graph.

Parameters:
graph - the AtomGraph to decorate
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

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

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

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

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

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

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.

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

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

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

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

The Octet Molecular Representation Framework v0.8.2