The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Interface AtomPairCollection

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

public interface AtomPairCollection

AtomPairCollection represents an immutable group of AtomPairs. Any AtomPair may be present, but null is disallowed. AtomPairs from different Molecules may or may not be present, depending on implementation.

AtomPairCollection places the additional restriction on implementors that all methods are consistent - they can be assumed to return the same results throughout the Object's lifetime.

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

Method Summary
 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.
 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.
 AtomPair[] toAtomPairArray()
          Returns a copy of the atom pairs contained in this collection as an array.
 

Method Detail

containsAtomPair

public boolean containsAtomPair(AtomPair pair)
Returns true if an AtomPair matching pair is contained in this collection.

Parameters:
pair - the AtomPair to search for
Returns:
true if found, false otherwise

containsAtomPair

public boolean containsAtomPair(Atom source,
                                Atom target)
Returns true if an AtomPair connecting source and target is contained in this collection.

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)
Returns an AtomPair containing the specified source and target Atoms. If no such pair is found, null is returned.

Parameters:
source - the source atom
target - the target atom
Returns:
the matching AtomPair
Throws:
NoSuchAtomPairException - if no AtomPair connecting source and target could be found

countAtomPairs

public int countAtomPairs()
Returns the number of AtomPairs contained in this collection.

Returns:
the number of AtomPairs contained in this collection.

iterateAtomPairs

public AtomPairIterator iterateAtomPairs()
Returns an iterator over all AtomPairs in this collection.

Returns:
an iterator over all AtomPairs in this collection

getAtomPairIndex

public int getAtomPairIndex(AtomPair pair)
Returns the index of the specified AtomPair.

Parameters:
pair - the AtomPair to search for
Returns:
the index of the AtomPair

getAtomPair

public AtomPair getAtomPair(int index)
Returns the AtomPair corresponding to the specified integer index.

Parameters:
index - the index to search for
Returns:
the AtomPair at the specified index
Throws:
java.lang.IndexOutOfBoundsException - if index is less than zero or greater than or equal to the number of AtomPairs

toAtomPairArray

public AtomPair[] toAtomPairArray()
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.

Returns:
a copy of the atom pair array for this collection

The Octet Molecular Representation Framework v0.8.2