The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Class BasicAtomGraphCollection

java.lang.Object
  extended bynet.sf.octet.collection.BasicAtomGraphCollection
All Implemented Interfaces:
AtomGraphCollection

public class BasicAtomGraphCollection
extends java.lang.Object
implements AtomGraphCollection

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

Author:
Richard Apodaca

Constructor Summary
BasicAtomGraphCollection()
          Creates an empty SubgraphCollection.
BasicAtomGraphCollection(AtomGraph[] graphs)
          Constructs a BasicAtomGraphCollection from the elements contained in graphs.
BasicAtomGraphCollection(java.util.Collection graphs)
          Constructs a BasicAtomGraphCollection from the elements contained in graphs.
 
Method Summary
 boolean containsAtomGraph(AtomGraph graph)
          Returns true if an AtomGraph matching graph, as determined by Object.equals, is contained in this collection.
 int countAtomGraphs()
          Returns the number of AtomGraphs contained in this collection.
 AtomGraph getAtomGraph(int index)
          Returns the AtomGraph contained at the specified zero-based index.
 int getAtomGraphIndex(AtomGraph graph)
          Returns the zero-based index of the specified AtomGraph as determined by Object.equals or -1 if no match is found.
 AtomGraphIterator iterateAtomGraphs()
          Returns an iterator over all AtomGraphs in this collection.
 AtomGraph[] toAtomGraphArray()
          Returns a copy of the AtomGraphs 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

BasicAtomGraphCollection

public BasicAtomGraphCollection()
Creates an empty SubgraphCollection.


BasicAtomGraphCollection

public BasicAtomGraphCollection(java.util.Collection graphs)
Constructs a BasicAtomGraphCollection from the elements contained in graphs.

Parameters:
graphs - the collection from which to get AtomGraphs
Throws:
java.lang.IllegalArgumentException - if graphs contains Objects that do not implement AtomGraph
java.lang.NullPointerException - if graphs contains null

BasicAtomGraphCollection

public BasicAtomGraphCollection(AtomGraph[] graphs)
Constructs a BasicAtomGraphCollection from the elements contained in graphs.

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

containsAtomGraph

public boolean containsAtomGraph(AtomGraph graph)
Description copied from interface: AtomGraphCollection
Returns true if an AtomGraph matching graph, as determined by Object.equals, is contained in this collection.

Specified by:
containsAtomGraph in interface AtomGraphCollection
Parameters:
graph - the AtomGraph to search for
Returns:
true if found, false otherwise

countAtomGraphs

public int countAtomGraphs()
Description copied from interface: AtomGraphCollection
Returns the number of AtomGraphs contained in this collection.

Specified by:
countAtomGraphs in interface AtomGraphCollection
Returns:
the number of AtomGraphs contained in this collection.

getAtomGraph

public AtomGraph getAtomGraph(int index)
Description copied from interface: AtomGraphCollection
Returns the AtomGraph contained at the specified zero-based index.

Specified by:
getAtomGraph in interface AtomGraphCollection
Parameters:
index - the index to search
Returns:
the AtomGraph at index

getAtomGraphIndex

public int getAtomGraphIndex(AtomGraph graph)
Description copied from interface: AtomGraphCollection
Returns the zero-based index of the specified AtomGraph as determined by Object.equals or -1 if no match is found.

Specified by:
getAtomGraphIndex in interface AtomGraphCollection
Parameters:
graph - the subgraph for which to find an index
Returns:
the index of graph, or -1 if no match is found

iterateAtomGraphs

public AtomGraphIterator iterateAtomGraphs()
Description copied from interface: AtomGraphCollection
Returns an iterator over all AtomGraphs in this collection.

Specified by:
iterateAtomGraphs in interface AtomGraphCollection
Returns:
an iterator over all AtomGraphs in this collection

toAtomGraphArray

public AtomGraph[] toAtomGraphArray()
Description copied from interface: AtomGraphCollection
Returns a copy of the AtomGraphs contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toAtomGraphArray in interface AtomGraphCollection
Returns:
a copy of the AtomGraph array for this collection

The Octet Molecular Representation Framework v0.8.2