org.jscience.chemistry.gui.extended.molecule
Class MoleculeVector

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by org.jscience.chemistry.gui.extended.molecule.MoleculeVector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class MoleculeVector
extends java.util.Vector

Tripos MoleculeVector class

See Also:
Molecule, Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
MoleculeVector()
          Default constructor
MoleculeVector(int cap)
          Capacity constructor
MoleculeVector(int cap, int inc)
          Capacity & increment constructor
MoleculeVector(MoleculeVector mv)
          Copy constructor.
 
Method Summary
 void append(Molecule mol)
          Append a molecule to the end of vector
 void appendUnique(Molecule mol)
          Append a molecule to the end of vector only if the molecule is not already present in the MoleculeVector
 boolean equals(MoleculeVector av)
          Compares this MoleculeVector with another
 Molecule firstMolecule()
          Returns first molecule in MoleculeVector
 Molecule getMolecule(int i)
          Returns molecule at specified index
 void insert(Molecule mol, int i)
          Insert a molecule at specified index; other molecules are shifted over
 Molecule lastMolecule()
          Returns last molecule in MoleculeVector
 boolean remove(Molecule mol)
          Remove a molecule; other molecules are shifted down
 void removeMolecule(int i)
          Remove molecule at specified index; other molecules are shifted down
 void set(Molecule mol, int i)
          Set a molecule at specified index; molecule at index is replaced
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

MoleculeVector

public MoleculeVector()
Default constructor


MoleculeVector

public MoleculeVector(int cap)
Capacity constructor

Parameters:
cap - initial capacity of vector

MoleculeVector

public MoleculeVector(int cap,
                      int inc)
Capacity & increment constructor

Parameters:
cap - initial capacity of vector
inc - increment factor

MoleculeVector

public MoleculeVector(MoleculeVector mv)
Copy constructor.

Parameters:
mv - MoleculeVector to be copied
Method Detail

append

public final void append(Molecule mol)
Append a molecule to the end of vector

Parameters:
mol - molecule to be appended

appendUnique

public final void appendUnique(Molecule mol)
Append a molecule to the end of vector only if the molecule is not already present in the MoleculeVector

Parameters:
mol - molecule to be appended

getMolecule

public final Molecule getMolecule(int i)
                           throws java.lang.ArrayIndexOutOfBoundsException
Returns molecule at specified index

Parameters:
i - index of molecule
Returns:
DOCUMENT ME!
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index >= capacity()

set

public final void set(Molecule mol,
                      int i)
Set a molecule at specified index; molecule at index is replaced

Parameters:
mol - molecule to be set
i - index to place molecule

insert

public final void insert(Molecule mol,
                         int i)
Insert a molecule at specified index; other molecules are shifted over

Parameters:
mol - molecule to be inserted
i - index of insertion

remove

public final boolean remove(Molecule mol)
Remove a molecule; other molecules are shifted down

Parameters:
mol - molecule to be removed
Returns:
true if molecule was removed, else false

removeMolecule

public final void removeMolecule(int i)
                          throws java.lang.ArrayIndexOutOfBoundsException
Remove molecule at specified index; other molecules are shifted down

Parameters:
i - index of molecule
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index >= capacity()

firstMolecule

public final Molecule firstMolecule()
                             throws java.util.NoSuchElementException
Returns first molecule in MoleculeVector

Returns:
DOCUMENT ME!
Throws:
java.util.NoSuchElementException - if size() == 0

lastMolecule

public final Molecule lastMolecule()
                            throws java.util.NoSuchElementException
Returns last molecule in MoleculeVector

Returns:
DOCUMENT ME!
Throws:
java.util.NoSuchElementException - if size() == 0

equals

public boolean equals(MoleculeVector av)
Compares this MoleculeVector with another

Parameters:
av - MoleculeVector to compare with
Returns:
true if they are equal, else false