cct.modelling
Class AtomsArray

java.lang.Object
  extended by cct.modelling.AtomsArray

public class AtomsArray
extends java.lang.Object

Title: AtomsArray

Description: This class keeps track about atoms/residues addition

Copyright: Copyright (c) 2006

Company: ANU


Field Summary
protected  java.util.ArrayList Atoms
           
protected  java.util.ArrayList Residues
           
 
Constructor Summary
AtomsArray()
          Creates a new atom array.
AtomsArray(AtomsArray av)
          Copy constructor
 
Method Summary
 void addAtom(AtomInterface a)
          Adds atom to the last residue in the list
 void addAtom(AtomInterface a, int n)
          Adds atom to the existing nth monomer.
 void addAtom(AtomInterface a, int n, java.lang.String name)
           
 void addAtom(AtomInterface a, java.lang.String monomer_name)
          Adds a new monomer and adds an atom to the monomer
 void addMonomer(java.lang.String monomer_name)
           
 boolean equals(AtomsArray av)
          Compares this AtomArray with another
 gAtom firstAtom()
          Returns first atom in AtomVector
 AtomInterface getAtom(int i)
          Returns ith atom
 int getAtomIndex(AtomInterface a)
          Returns atom number in the list.
 AtomInterface getAtomInterface(int i)
           
 Monomer getMonomer(int n)
          Returns nth monomer from the list.
 int getNumberOfMonomers()
          Returns number of monomers
 java.util.HashSet<java.lang.String> getUniqueMonomersInMolecule()
           
 boolean hasAtom(gAtom atom)
           
 void insert(gAtom a, int i)
          Insert an atom at specified index; other atoms are shifted over
 gAtom lastAtom()
          Returns last atom in AtomVector
(package private)  gAtom remove(int i)
           
 void removeAllAtoms()
          Remove all atoms
 boolean removeAtom(AtomInterface a)
          Removes atom from the list
 gAtom removeAtom(int i)
          Remove atom at specified index; other atoms are shifted down
 void replace(gAtom a, int i)
          Set an atom at specified index; atom at index is replaced
(package private)  void set(gAtom a, int i)
           
(package private)  int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Atoms

protected java.util.ArrayList Atoms

Residues

protected java.util.ArrayList Residues
Constructor Detail

AtomsArray

public AtomsArray()
Creates a new atom array.


AtomsArray

public AtomsArray(AtomsArray av)
Copy constructor

Method Detail

addMonomer

public void addMonomer(java.lang.String monomer_name)

addAtom

public void addAtom(AtomInterface a)
Adds atom to the last residue in the list

Parameters:
a - gAtom

addAtom

public void addAtom(AtomInterface a,
                    java.lang.String monomer_name)
Adds a new monomer and adds an atom to the monomer

Parameters:
a - gAtom Atom to be added
monomer_name - String Name of new monomer to be added

addAtom

public void addAtom(AtomInterface a,
                    int n)
Adds atom to the existing nth monomer.

Parameters:
a - gAtom Atom to be added
n - int Monomer number

addAtom

public void addAtom(AtomInterface a,
                    int n,
                    java.lang.String name)
Parameters:
a - gAtom
n - int
name - String

getAtom

public AtomInterface getAtom(int i)
                      throws java.lang.ArrayIndexOutOfBoundsException
Returns ith atom

Throws:
java.lang.ArrayIndexOutOfBoundsException - if index >= capacity()

getAtomInterface

public AtomInterface getAtomInterface(int i)
                               throws java.lang.ArrayIndexOutOfBoundsException
Throws:
java.lang.ArrayIndexOutOfBoundsException

getAtomIndex

public int getAtomIndex(AtomInterface a)
Returns atom number in the list.

Parameters:
a - gAtom Atom in question
Returns:
int Atom number. -1 if no such atom in the list.

getMonomer

public Monomer getMonomer(int n)
Returns nth monomer from the list.

Parameters:
n - int - Monomer number
Returns:
Monomer - Returns nth monomer or null if n is out of bounds

getNumberOfMonomers

public int getNumberOfMonomers()
Returns number of monomers

Returns:
int Returns number of monomers

replace

public void replace(gAtom a,
                    int i)
Set an atom at specified index; atom at index is replaced


insert

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


removeAtom

public boolean removeAtom(AtomInterface a)
Removes atom from the list

Parameters:
a - gAtom - Atom to be removed
Returns:
boolean Returns "true" in the case of success, "false" otherwise

removeAtom

public gAtom 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 void removeAllAtoms()
                    throws java.lang.ArrayIndexOutOfBoundsException
Remove all atoms

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

firstAtom

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

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

lastAtom

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

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

equals

public boolean equals(AtomsArray av)
Compares this AtomArray with another

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

remove

gAtom remove(int i)
       throws java.lang.ArrayIndexOutOfBoundsException
Throws:
java.lang.ArrayIndexOutOfBoundsException

set

void set(gAtom a,
         int i)

size

int size()

hasAtom

public boolean hasAtom(gAtom atom)

getUniqueMonomersInMolecule

public java.util.HashSet<java.lang.String> getUniqueMonomersInMolecule()