The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Class BasicAtomicSymbolCollection

java.lang.Object
  extended bynet.sf.octet.collection.BasicAtomicSymbolCollection
All Implemented Interfaces:
AtomicSymbolCollection

public class BasicAtomicSymbolCollection
extends java.lang.Object
implements AtomicSymbolCollection

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

Author:
Richard Apodaca

Constructor Summary
BasicAtomicSymbolCollection()
          Constructs a fully functional and empty BasicAtomicSymbolCollection.
BasicAtomicSymbolCollection(AtomicSymbol[] symbols)
          Constructs a BasicAtomicSymbolCollection from the elements contained in symbols.
BasicAtomicSymbolCollection(java.util.Collection symbols)
          Constructs a BasicAtomicSymbolCollection from the elements contained in symbols.
 
Method Summary
 boolean containsAtomicSymbol(AtomicSymbol symbol)
          Returns true if the specified AtomicSymbol is contained in this collection, and false otherwise.
 int countAtomicSymbols()
          Returns the number of AtomicSymbols contained in this collection.
 AtomicSymbol getAtomicSymbol(int index)
          Returns the AtomicSymbol located at the specified zero-based index.
 int getAtomicSymbolIndex(AtomicSymbol symbol)
          Returns the zero-based index of the specified AtomicSymbol.
 AtomicSymbolIterator iterateAtomicSymbols()
          Returns an iterator over all AtomicSymbols in this collection.
 AtomicSymbol[] toAtomicSymbolArray()
          Returns a copy of the AtomicSymbols 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

BasicAtomicSymbolCollection

public BasicAtomicSymbolCollection()
Constructs a fully functional and empty BasicAtomicSymbolCollection.


BasicAtomicSymbolCollection

public BasicAtomicSymbolCollection(java.util.Collection symbols)
Constructs a BasicAtomicSymbolCollection from the elements contained in symbols.

Parameters:
symbols - the collection from which to get AtomicSymbols
Throws:
java.lang.IllegalArgumentException - if symbols contains Objects that do not implement AtomicSymbol
java.lang.NullPointerException - if symbols contains null

BasicAtomicSymbolCollection

public BasicAtomicSymbolCollection(AtomicSymbol[] symbols)
Constructs a BasicAtomicSymbolCollection from the elements contained in symbols.

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

containsAtomicSymbol

public boolean containsAtomicSymbol(AtomicSymbol symbol)
Description copied from interface: AtomicSymbolCollection
Returns true if the specified AtomicSymbol is contained in this collection, and false otherwise.

Specified by:
containsAtomicSymbol in interface AtomicSymbolCollection
Parameters:
symbol - the AtomicSymbol
Returns:
true if contained, false otherwise

countAtomicSymbols

public int countAtomicSymbols()
Description copied from interface: AtomicSymbolCollection
Returns the number of AtomicSymbols contained in this collection.

Specified by:
countAtomicSymbols in interface AtomicSymbolCollection
Returns:
the number of AtomicSymbols in this collection

getAtomicSymbolIndex

public int getAtomicSymbolIndex(AtomicSymbol symbol)
Description copied from interface: AtomicSymbolCollection
Returns the zero-based index of the specified AtomicSymbol.

Specified by:
getAtomicSymbolIndex in interface AtomicSymbolCollection
Parameters:
symbol - the AtomicSymbol
Returns:
the index of the AtomicSymbol, or -1 if this collection does not contain symbol

getAtomicSymbol

public AtomicSymbol getAtomicSymbol(int index)
Description copied from interface: AtomicSymbolCollection
Returns the AtomicSymbol located at the specified zero-based index.

Specified by:
getAtomicSymbol in interface AtomicSymbolCollection
Parameters:
index - the index
Returns:
the AtomicSymbol at index, or null if the index is invalid

iterateAtomicSymbols

public AtomicSymbolIterator iterateAtomicSymbols()
Description copied from interface: AtomicSymbolCollection
Returns an iterator over all AtomicSymbols in this collection.

Specified by:
iterateAtomicSymbols in interface AtomicSymbolCollection
Returns:
an iterator over all AtomicSymbols in this collection

toAtomicSymbolArray

public AtomicSymbol[] toAtomicSymbolArray()
Description copied from interface: AtomicSymbolCollection
Returns a copy of the AtomicSymbols contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toAtomicSymbolArray in interface AtomicSymbolCollection
Returns:
a copy of the AtomicSymbol array for this collection

The Octet Molecular Representation Framework v0.8.2