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

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.AtomVector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class AtomVector
extends java.util.Vector

Tripos AtomVector class

See Also:
Atom, Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AtomVector()
          Default constructor
AtomVector(AtomVector av)
          Copy constructor
AtomVector(int cap)
          Capacity constructor
AtomVector(int cap, int inc)
          Capacity and increment constructor
 
Method Summary
 void append(Atom a)
          Append an atom to the end of vector
 boolean equals(AtomVector av)
          Compares this AtomVector with another
 Atom firstAtom()
          Returns first atom in AtomVector
 Atom getAtom(int i)
          Returns atom at specified index
 void insert(Atom a, int i)
          Insert an atom at specified index; other atoms are shifted over
 Atom lastAtom()
          Returns last atom in AtomVector
 void removeAllAtoms()
          Remove all atoms
 boolean removeAtom(Atom a)
          Remove an atom; other atoms are shifted down
 void removeAtom(int i)
          Remove atom at specified index; other atoms are shifted down
 void set(Atom a, int i)
          Set an atom at specified index; atom 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

AtomVector

public AtomVector()
Default constructor


AtomVector

public AtomVector(int cap)
Capacity constructor

Parameters:
cap - initial capacity of vector

AtomVector

public AtomVector(int cap,
                  int inc)
Capacity and increment constructor

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

AtomVector

public AtomVector(AtomVector av)
Copy constructor

Parameters:
av - AtomVector to be copied
Method Detail

append

public final void append(Atom a)
Append an atom to the end of vector

Parameters:
a - atom to be appended

getAtom

public final Atom getAtom(int i)
                   throws java.lang.ArrayIndexOutOfBoundsException
Returns atom at specified index

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

set

public final void set(Atom a,
                      int i)
Set an atom at specified index; atom at index is replaced

Parameters:
a - atom to be set
i - index to place atom

insert

public final void insert(Atom a,
                         int i)
Insert an atom at specified index; other atoms are shifted over

Parameters:
a - atom to be inserted
i - index of insertion

removeAtom

public final boolean removeAtom(Atom a)
Remove an atom; other atoms are shifted down

Parameters:
a - atom to be removed
Returns:
true if atom was removed, else false

removeAtom

public final void removeAtom(int i)
                      throws java.lang.ArrayIndexOutOfBoundsException
Remove atom at specified index; other atoms are shifted down

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

removeAllAtoms

public final void removeAllAtoms()
                          throws java.lang.ArrayIndexOutOfBoundsException
Remove all atoms

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

firstAtom

public final Atom firstAtom()
                     throws java.util.NoSuchElementException
Returns first atom in AtomVector

Throws:
java.util.NoSuchElementException - if size() == 0

lastAtom

public final Atom lastAtom()
                    throws java.util.NoSuchElementException
Returns last atom in AtomVector

Throws:
java.util.NoSuchElementException - if size() == 0

equals

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

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