The Octet Molecular Representation Framework v0.8.2

net.sf.octet.model
Class BasicNonbondingShell

java.lang.Object
  extended bynet.sf.octet.model.BasicNonbondingShell
All Implemented Interfaces:
ElectronCollection, NonbondingShell, OrbitalCollection

public class BasicNonbondingShell
extends java.lang.Object
implements NonbondingShell

A default implementation of the NonbondingShell interface.

Author:
Richard Apodaca

Constructor Summary
BasicNonbondingShell()
          Constructs a fully functional, empty BasicNonbondingShell.
BasicNonbondingShell(OrbitalCollection orbitals)
          Constructs a fully functional BasicNonbondingShell from orbitals.
 
Method Summary
 boolean containsElectron(Electron electron)
          Returns true if the specified Electron is contained in this collection, and false otherwise.
 boolean containsOrbital(Orbital orbital)
          Returns true if the specified Orbital is contained in this collection, and false otherwise.
 int countElectrons()
          Returns the number of Electrons contained in this collection.
 int countOrbitals()
          Returns the number of Orbitals contained in this Orbital 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.
static BasicNonbondingShell getNullSingleton()
          Returns a singleton BasicNonbondingShell that is empty.
 Orbital getOrbital(int index)
          Returns the Orbital located at the specified zero-based index.
 int getOrbitalIndex(Orbital orbital)
          Returns the zero-based index of the specified Orbital.
 ElectronIterator iterateElectrons()
          Returns an iterator over all Electrons in this collection.
 OrbitalIterator iterateOrbitals()
          Returns an iterator over all Orbitals in this collection.
 Electron[] toElectronArray()
          Returns a copy of the Electrons contained in this collection as an array.
 Orbital[] toOrbitalArray()
          Returns a copy of the Orbitals 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

BasicNonbondingShell

public BasicNonbondingShell()
Constructs a fully functional, empty BasicNonbondingShell.


BasicNonbondingShell

public BasicNonbondingShell(OrbitalCollection orbitals)
Constructs a fully functional BasicNonbondingShell from orbitals.

Parameters:
orbitals - the OrbitalCollection
Throws:
IllegalRepresentationException - if a valid NonbondingShell can not be constructed from orbitals
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

containsOrbital

public boolean containsOrbital(Orbital orbital)
Description copied from interface: OrbitalCollection
Returns true if the specified Orbital is contained in this collection, and false otherwise.

Specified by:
containsOrbital in interface OrbitalCollection
Parameters:
orbital - the Orbital
Returns:
true if contained, false otherwise

countOrbitals

public int countOrbitals()
Description copied from interface: OrbitalCollection
Returns the number of Orbitals contained in this Orbital collection.

Specified by:
countOrbitals in interface OrbitalCollection
Returns:
the number of Orbitals in this collection

getOrbitalIndex

public int getOrbitalIndex(Orbital orbital)
Description copied from interface: OrbitalCollection
Returns the zero-based index of the specified Orbital.

Specified by:
getOrbitalIndex in interface OrbitalCollection
Parameters:
orbital - the Orbital
Returns:
the index of the Orbital, or -1 if this collection does not contain orbital

iterateOrbitals

public OrbitalIterator iterateOrbitals()
Description copied from interface: OrbitalCollection
Returns an iterator over all Orbitals in this collection.

Specified by:
iterateOrbitals in interface OrbitalCollection
Returns:
an iterator over all Orbitals in this collection

getOrbital

public Orbital getOrbital(int index)
Description copied from interface: OrbitalCollection
Returns the Orbital located at the specified zero-based index.

Specified by:
getOrbital in interface OrbitalCollection
Parameters:
index - the index
Returns:
the Orbital at index, or null if the index is invalid

toOrbitalArray

public Orbital[] toOrbitalArray()
Description copied from interface: OrbitalCollection
Returns a copy of the Orbitals contained in this collection as an array. The resulting array may be modified without changing the state of this collection.

Specified by:
toOrbitalArray in interface OrbitalCollection
Returns:
a copy of the Orbital array for this collection

getNullSingleton

public static BasicNonbondingShell getNullSingleton()
Returns a singleton BasicNonbondingShell that is empty. This instance can be used as part of the NullObject Design Pattern to fulfil the Molecule contract without providing an underlying implementation.

Returns:
a singleton empty instance of BasicNonbondingShell

The Octet Molecular Representation Framework v0.8.2