The Octet Molecular Representation Framework v0.8.2

net.sf.octet.collection
Class BasicElectronCollection

java.lang.Object
  extended bynet.sf.octet.collection.BasicElectronCollection
All Implemented Interfaces:
ElectronCollection
Direct Known Subclasses:
BasicOrbital

public class BasicElectronCollection
extends java.lang.Object
implements ElectronCollection

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

Author:
Richard Apodaca

Constructor Summary
BasicElectronCollection()
          Constructs an empty BasicElectronCollection.
BasicElectronCollection(java.util.Collection electrons)
          Constructs a BasicElectronCollection from the elements contained in electrons.
BasicElectronCollection(Electron[] electrons)
          Constructs a BasicElectronCollection from the elements contained in electrons.
 
Method Summary
 boolean containsElectron(Electron electron)
          Returns true if the specified Electron is contained in this collection, and false otherwise.
 int countElectrons()
          Returns the number of Electrons contained in this collection.
 Electron getElectron(int index)
          Returns the Electron located at the specified zero-based index.
 int getElectronIndex(Electron electron)
          Returns the zero-based index of the specified Electron.
 ElectronIterator iterateElectrons()
          Returns an iterator over all Electrons in this collection.
 Electron[] toElectronArray()
          Returns a copy of the Electrons 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

BasicElectronCollection

public BasicElectronCollection()
Constructs an empty BasicElectronCollection.


BasicElectronCollection

public BasicElectronCollection(java.util.Collection electrons)
Constructs a BasicElectronCollection from the elements contained in electrons.

Parameters:
electrons - the collection from which to get Electrons
Throws:
java.lang.IllegalArgumentException - if electrons contains Objects that do not implement Electron
java.lang.NullPointerException - if electrons contains null

BasicElectronCollection

public BasicElectronCollection(Electron[] electrons)
Constructs a BasicElectronCollection from the elements contained in electrons.

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

containsElectron

public boolean containsElectron(Electron electron)
Description copied from interface: ElectronCollection
Returns true if the specified Electron is contained in this collection, and false otherwise.

Specified by:
containsElectron in interface ElectronCollection
Parameters:
electron - the Electron
Returns:
true if contained, false otherwise

countElectrons

public int countElectrons()
Description copied from interface: ElectronCollection
Returns the number of Electrons contained in this collection.

Specified by:
countElectrons in interface ElectronCollection
Returns:
the number of Electrons in this collection

getElectronIndex

public int getElectronIndex(Electron electron)
Description copied from interface: ElectronCollection
Returns the zero-based index of the specified Electron.

Specified by:
getElectronIndex in interface ElectronCollection
Parameters:
electron - the atom
Returns:
the index of the electron, or -1 if this collection does not contain electron

getElectron

public Electron getElectron(int index)
Description copied from interface: ElectronCollection
Returns the Electron located at the specified zero-based index.

Specified by:
getElectron in interface ElectronCollection
Parameters:
index - the index
Returns:
the Electron at index, or null if the index is invalid

iterateElectrons

public ElectronIterator iterateElectrons()
Description copied from interface: ElectronCollection
Returns an iterator over all Electrons in this collection.

Specified by:
iterateElectrons in interface ElectronCollection
Returns:
an iterator over all Electrons in this collection

toElectronArray

public Electron[] toElectronArray()
Description copied from interface: ElectronCollection
Returns a copy of the Electrons contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toElectronArray in interface ElectronCollection
Returns:
a copy of the Electron array for this collection

The Octet Molecular Representation Framework v0.8.2