belka.mol
Class Chain

java.lang.Object
  extended by belka.mol.Chain
All Implemented Interfaces:
Serializable

public abstract class Chain
extends Object
implements Serializable

Abstract class describing behavior of a chain. Chain is a set of molecule building blocks. It can be, for example, polypetide chain, nucleotide chain, or set of water molecules.

Author:
Alexej Abyzov
See Also:
Serialized Form

Constructor Summary
Chain()
           
 
Method Summary
abstract  boolean addAfter(Chain newChain)
          Adds a chain after the current one.
abstract  boolean addAssembly(Assembly assembly)
          Adds an assembly to the end of assembly list for the current chain.
abstract  boolean addBefore(Chain newChain)
          Adds a chain before the current one.
abstract  Assembly assemblyList()
          Returns list of assemblies.
abstract  int countAssemblies()
          Returns number of assemblies in the chain.
abstract  int countAtoms()
          Returns number of atoms in the chain.
static Chain create(char id)
          Static method to create a new chain.
abstract  void disassemble()
          Disassembles chain into null pointers to help garbage collector to free memory.
abstract  char getId()
          Returns chain's id.
abstract  int getModel()
          Returns chain's model number.
abstract  String getSequence()
          Returns sequence of the chain.
abstract  Molecule molecule()
          Returns a molecule the chain belongs to.
abstract  Chain next()
          Returns next chain in list.
abstract  Chain prev()
          Returns previous chain in list.
abstract  int removeGaps()
          Removes assemblies that are gaps from the list of assemblies.
abstract  void resetGroupId(int val)
          Resets group id for assemblies in the chain to the specified value.
abstract  void selectAllAtoms(boolean val)
          Select or deselect all atoms in a chain.
abstract  void setModel(int model)
          Sets chain's model number.
abstract  boolean setMolecule(Molecule mol)
          Sets a molecule the chain belongs to.
 String toString()
          Returns string representation of the chain.
abstract  void updateAssemblyPointers()
          The function updates pointers to the first and last assemblies belonging to the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Chain

public Chain()
Method Detail

create

public static Chain create(char id)
Static method to create a new chain.

Parameters:
id - chain's id.
Returns:
new created chain.

disassemble

public abstract void disassemble()
Disassembles chain into null pointers to help garbage collector to free memory.


next

public abstract Chain next()
Returns next chain in list.

Returns:
next chain in list.

prev

public abstract Chain prev()
Returns previous chain in list.

Returns:
previous chain in list.

addAfter

public abstract boolean addAfter(Chain newChain)
Adds a chain after the current one. The function adds the chain only if it is not linked to any other chain and if the current chain does not have linked next chain.

Parameters:
newChain - chain to add.
Returns:
'true' if the newChain has been added, 'false' otherwise.

addBefore

public abstract boolean addBefore(Chain newChain)
Adds a chain before the current one. The function adds the chain only if it is not linked to any other chain and if the current chain does not have linked previous chain.

Parameters:
newChain - chain to add.
Returns:
'true' if the newChain has been added, 'false' otherwise.

assemblyList

public abstract Assembly assemblyList()
Returns list of assemblies.

Returns:
list of assemblies.

addAssembly

public abstract boolean addAssembly(Assembly assembly)
Adds an assembly to the end of assembly list for the current chain. The assembly must be not linked to other assembly. The function sets reference to the current chain for added assembly.

Parameters:
assembly - assembly to add.
Returns:
'true' if the assembly has been added, 'false' otherwise.

updateAssemblyPointers

public abstract void updateAssemblyPointers()
The function updates pointers to the first and last assemblies belonging to the chain. It assumes that the assemblies where it currently has pointers set are not deleted from the chain at the time of function call. Therefore, it travels up and down the assembly list to find the beginning and end. Note that you must call this function is you modify the list of assemblies externaly. Internal methods of the class update the pointer automatically.


removeGaps

public abstract int removeGaps()
Removes assemblies that are gaps from the list of assemblies. Returns number of removed assemblies.

Returns:
number of removed gaps.

molecule

public abstract Molecule molecule()
Returns a molecule the chain belongs to.

Returns:
a molecule the chain belongs to.

setMolecule

public abstract boolean setMolecule(Molecule mol)
Sets a molecule the chain belongs to. The molecule is set only if the chain does not belong to other molecule.

Parameters:
mol - molecule to set.
Returns:
'true' if the mol has been set, 'false' otherwise.

getId

public abstract char getId()
Returns chain's id.

Returns:
chain's id.

getModel

public abstract int getModel()
Returns chain's model number.

Returns:
chain's model number.

setModel

public abstract void setModel(int model)
Sets chain's model number.

Parameters:
model - chain's model number.

countAssemblies

public abstract int countAssemblies()
Returns number of assemblies in the chain.

Returns:
number of assemblies in the chain.

countAtoms

public abstract int countAtoms()
Returns number of atoms in the chain.

Returns:
number of atoms in the chain.

selectAllAtoms

public abstract void selectAllAtoms(boolean val)
Select or deselect all atoms in a chain.

Parameters:
val - if true -- select all atoms, if false -- deselect.

getSequence

public abstract String getSequence()
Returns sequence of the chain.

Returns:
sequence of the chain.

resetGroupId

public abstract void resetGroupId(int val)
Resets group id for assemblies in the chain to the specified value.


toString

public String toString()
Returns string representation of the chain.

Overrides:
toString in class Object
Returns:
string representation of the chain.