The Octet Molecular Representation Framework v0.8.2

net.sf.octet.model
Class SimpleBondingSystem

java.lang.Object
  extended bynet.sf.octet.model.SimpleBondingSystem
All Implemented Interfaces:
AtomCollection, AtomGraph, AtomPairCollection, BondingSystem

public class SimpleBondingSystem
extends java.lang.Object
implements BondingSystem

An implementation of the BondingSystem interface that is optimized for two- Atom bonding. Use SimpleBondingSystem to optimize performance in those cases in which a two-Atom BondingSystem is used. Because the majority of BondingSystems in any represenation will be restricted to two Atoms only, SimpleBondingSystem offers faster access time and a lower memory footprint compared to BasicBondingSystem.

Author:
Richard Apodaca

Constructor Summary
SimpleBondingSystem(AtomPair pair, int bondingElectronCount)
          Convenience constructor that constructs a SimpleBondingSystem with bonding electrons only.
SimpleBondingSystem(AtomPair pair, int bondingElectronCount, int antibondingElectronCount)
          Constructs a SimpleBondingSystem from pair with the indicated electron counts.
 
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 countAntibondingElectrons()
          Returns the number of antibonding electrons in this BondingSystem.
 int countAtomPairs()
          Returns the number of AtomPairs contained in this collection.
 int countAtoms()
          Returns the number of Atoms contained in this atom collection.
 int countBondingElectrons()
          Returns the number of bonding electrons associated with this BondingSystem.
 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

SimpleBondingSystem

public SimpleBondingSystem(AtomPair pair,
                           int bondingElectronCount,
                           int antibondingElectronCount)
Constructs a SimpleBondingSystem from pair with the indicated electron counts.

Parameters:
pair - the AtomPair
bondingElectronCount - the bonding electron count
antibondingElectronCount - the antibonding electron count

SimpleBondingSystem

public SimpleBondingSystem(AtomPair pair,
                           int bondingElectronCount)
Convenience constructor that constructs a SimpleBondingSystem with bonding electrons only. Antibonding electron count is initialized to zero.

Parameters:
pair - the AtomPair
bondingElectronCount - the bonding electron count
Method Detail

countBondingElectrons

public int countBondingElectrons()
Description copied from interface: BondingSystem
Returns the number of bonding electrons associated with this BondingSystem.

Specified by:
countBondingElectrons in interface BondingSystem
Returns:
the number of bonding electrons in the specified BondingSystem

countAntibondingElectrons

public int countAntibondingElectrons()
Description copied from interface: BondingSystem
Returns the number of antibonding electrons in this BondingSystem.

Specified by:
countAntibondingElectrons in interface BondingSystem
Returns:
the number of antibonding electrons in the specified BondingSystem

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

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

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

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

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

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(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

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

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

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

The Octet Molecular Representation Framework v0.8.2