The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Class BasicAtomPairCollection

java.lang.Object
  extended bynet.sf.octet.collection.BasicAtomPairCollection
All Implemented Interfaces:
AtomPairCollection

public class BasicAtomPairCollection
extends java.lang.Object
implements AtomPairCollection

A default implementation of the AtomPairCollection interface backed by an ArraySequence.

Author:
Richard Apodaca

Constructor Summary
BasicAtomPairCollection()
          Constructs an empty, fully functional BasicAtomPairCollection.
BasicAtomPairCollection(AtomPair[] pairs)
          Constructs a BasicAtomPairCollection from the elements contained in pairs.
BasicAtomPairCollection(java.util.Collection pairs)
          Constructs a BasicAtomPairCollection from the elements contained in pairs.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAtomPairCollection

public BasicAtomPairCollection()
Constructs an empty, fully functional BasicAtomPairCollection.


BasicAtomPairCollection

public BasicAtomPairCollection(java.util.Collection pairs)
Constructs a BasicAtomPairCollection from the elements contained in pairs.

Parameters:
pairs - the collection from which to get AtomPairs
Throws:
java.lang.IllegalArgumentException - if pairs contains Objects that do not implement AtomPair
java.lang.NullPointerException - if pairs contains null

BasicAtomPairCollection

public BasicAtomPairCollection(AtomPair[] pairs)
Constructs a BasicAtomPairCollection from the elements contained in pairs.

Parameters:
pairs - the array from which to get AtomPairs
Throws:
java.lang.IllegalArgumentException - if pairs contains Objects that do not implement AtomPair
java.lang.NullPointerException - if pairs contains null
Method Detail

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

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

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