belka.mol
Class Atom

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

public abstract class Atom
extends Object
implements Serializable

Abstract class describing behavior of an atom.

Author:
Alexej Abyzov
See Also:
Serialized Form

Constructor Summary
Atom()
           
 
Method Summary
abstract  boolean addAfter(Atom newAtom)
          Adds an atom after the current one.
abstract  boolean addBefore(Atom newAtom)
          Adds an atom before the current one.
abstract  boolean addBond(Bond bond)
          Adds a covalent bond to the end of covalent bond array for the current atom.
abstract  Assembly assembly()
          Returns an assembly the atom belongs to.
abstract  Bond[] bondArray()
          Returns array of covalent bonds.
abstract  int countBonds()
          Returns number of bonds for the atom.
static Atom create(String name, double x, double y, double z, Element element)
          Static method to create new atom
abstract  void disassemble()
          Disassembles atom into null pointers to help garbage collector to free memory.
abstract  double distance2To(Atom atom)
          Returns squared distance to the given atom.
abstract  double distanceTo(Atom atom)
          Returns distance to the given atom.
abstract  char getAlternative()
          Returns atom's alternate location indicator.
abstract  Color getColor()
          Returns color of the sphere representing the atom on a screen.
abstract  double getDerivedX()
          Returns derived atom's X coordinate.
abstract  double getDerivedY()
          Returns derived atom's Y coordinate.
abstract  double getDerivedZ()
          Returns derived atom's Z coordinate.
abstract  Element getElement()
          Returns atom's chemical element.
abstract  String getName()
          Returns atom's name.
abstract  double getOccupancy()
          Returns atom's occupancy.
abstract  double getRadius()
          Returns radius of the sphere representing the atom.
abstract  int getScreenRadius()
          Returns radius of the sphere representing the atom on a screen.
abstract  int getScreenX()
          Returns atom's X coordinate on a screen.
abstract  int getScreenY()
          Returns atom's Y coordinate on a screen.
abstract  int getScreenZ()
          Returns atom's Z coordinate on a screen.
static int getSelectedAttribute()
          Returns flag attribute for selected atom.
abstract  int getSerialNum()
          Returns atom's serial number.
abstract  double getTemperature()
          Returns atom's temperature factor.
abstract  double getX()
          Returns atom's X coordinate.
abstract  double getY()
          Returns atom's Y coordinate.
abstract  double getZ()
          Returns atom's Z coordinate.
abstract  boolean hasAttribute(int att)
          Returns true if the provide attribute matches to the attributes of the atom.
abstract  boolean isC()
          Returns 'true' if atom is carbon of mainchain, 'false' otherwise.
abstract  boolean isCA()
          Returns 'true' if atom is alpha carbon, 'false' otherwise.
abstract  boolean isCB()
          Returns 'true' if atom is CB carbon, 'false' otherwise.
abstract  boolean isN()
          Returns 'true' if atom is nitrogen of mainchain, 'false' otherwise.
abstract  boolean isO()
          Returns 'true' if atom is oxygen of mainchain, 'false' otherwise.
abstract  boolean isSelected()
          Returns atom's selection status.
abstract  Atom next()
          Returns next atom in list.
abstract  Atom prev()
          Returns previous atom in list.
static double scaleToPixels()
          Returns scale used to transform atomic coordinates to pixel coordiantes.
abstract  void setAlternative(char altern)
          Sets atom's alternate location indicator.
abstract  boolean setAssembly(Assembly assembly)
          Sets assembly the atom belongs to.
abstract  void setColor(Color color)
          Sets atom's color on a screen.
abstract  void setDerivedX(double x)
          Sets derived atom's X coordinate.
abstract  void setDerivedY(double y)
          Sets derived atom's Y coordinate.
abstract  void setDerivedZ(double z)
          Sets derived atom's Z coordinate.
abstract  void setOccupancy(double occup)
          Sets atom's occupancy.
abstract  void setRadius(double r)
          Sets radius of the sphere representing the atom.
abstract  void setScreenRadius(double r)
          Sets radius of the sphere representing the atom on a screen.
abstract  void setScreenX(double x)
          Sets atom's X coordinate on a screen.
abstract  void setScreenY(double y)
          Sets atom's Y coordinate on a screen.
abstract  void setScreenZ(double z)
          Sets atom's Z coordinate on a screen.
abstract  void setSelected(boolean val)
          Sets atom's selection status.
abstract  void setSerialNum(int serial)
          Sets atom's serial number.
abstract  void setTemperature(double temper)
          Sets atom's temperature factor.
 String toString()
          Returns string representation of the atom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Atom

public Atom()
Method Detail

create

public static Atom create(String name,
                          double x,
                          double y,
                          double z,
                          Element element)
Static method to create new atom

Parameters:
name - atom's name.
x - atom's X coordinate.
y - atom's Y coordinate.
z - atom's Z coordinate.
element - atom's chemical element.
Returns:
new created atom.

disassemble

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


next

public abstract Atom next()
Returns next atom in list.

Returns:
next atom in list.

prev

public abstract Atom prev()
Returns previous atom in list.

Returns:
previous atom in list.

addAfter

public abstract boolean addAfter(Atom newAtom)
Adds an atom after the current one. The function adds the atom only if it is not linked to any other atom and if the current atom does not have linked next atom.

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

addBefore

public abstract boolean addBefore(Atom newAtom)
Adds an atom before the current one. The function adds the atom only if it is not linked to any other atom and if the current atom does not have linked previous atom.

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

assembly

public abstract Assembly assembly()
Returns an assembly the atom belongs to.

Returns:
an assembly the atom belongs to.

setAssembly

public abstract boolean setAssembly(Assembly assembly)
Sets assembly the atom belongs to. The assembly is set only if the atom does not belong to other assembly.

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

countBonds

public abstract int countBonds()
Returns number of bonds for the atom.

Returns:
number of bonds for the atom.

bondArray

public abstract Bond[] bondArray()
Returns array of covalent bonds.

Returns:
array of covalent bonds.

addBond

public abstract boolean addBond(Bond bond)
Adds a covalent bond to the end of covalent bond array for the current atom. Bond is added only if it is not already in the array of bonds for the current atom.

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

getX

public abstract double getX()
Returns atom's X coordinate.

Returns:
atom's X coordinate.

getY

public abstract double getY()
Returns atom's Y coordinate.

Returns:
atom's Y coordinate.

getZ

public abstract double getZ()
Returns atom's Z coordinate.

Returns:
atom's Z coordinate.

getDerivedX

public abstract double getDerivedX()
Returns derived atom's X coordinate.

Returns:
derived atom's X coordinate.

getDerivedY

public abstract double getDerivedY()
Returns derived atom's Y coordinate.

Returns:
derived atom's Y coordinate.

getDerivedZ

public abstract double getDerivedZ()
Returns derived atom's Z coordinate.

Returns:
derived atom's Z coordinate.

getScreenX

public abstract int getScreenX()
Returns atom's X coordinate on a screen.

Returns:
atom's X coordinate on a screen.

getScreenY

public abstract int getScreenY()
Returns atom's Y coordinate on a screen.

Returns:
atom's Y coordinate on a screen.

getScreenZ

public abstract int getScreenZ()
Returns atom's Z coordinate on a screen.

Returns:
atom's Z coordinate on a screen.

setDerivedX

public abstract void setDerivedX(double x)
Sets derived atom's X coordinate.

Parameters:
x - atom's derived X coordinate.

setDerivedY

public abstract void setDerivedY(double y)
Sets derived atom's Y coordinate.

Parameters:
y - atom's derived Y coordinate.

setDerivedZ

public abstract void setDerivedZ(double z)
Sets derived atom's Z coordinate.

Parameters:
z - atom's derived Z coordinate.

setScreenX

public abstract void setScreenX(double x)
Sets atom's X coordinate on a screen. Value is rescaled to int.

Parameters:
x - atom's X coordinate on a screen.

setScreenY

public abstract void setScreenY(double y)
Sets atom's Y coordinate on a screen. Value is rescaled to int.

Parameters:
y - atom's Y coordinate on a screen.

setScreenZ

public abstract void setScreenZ(double z)
Sets atom's Z coordinate on a screen. Value is rescaled to int.

Parameters:
z - atom's Z coordinate on a screen.

getRadius

public abstract double getRadius()
Returns radius of the sphere representing the atom.

Returns:
radius of the sphere representing the atom.

setRadius

public abstract void setRadius(double r)
Sets radius of the sphere representing the atom.

Parameters:
r - of the sphere representing the atom.

getScreenRadius

public abstract int getScreenRadius()
Returns radius of the sphere representing the atom on a screen.

Returns:
radius of the sphere representing the atom on a screen.

setScreenRadius

public abstract void setScreenRadius(double r)
Sets radius of the sphere representing the atom on a screen. Value is rescaled to int.

Parameters:
r - radius of the sphere representing the atom on a screen.

getColor

public abstract Color getColor()
Returns color of the sphere representing the atom on a screen.

Returns:
color of the sphere representing the atom on a screen.

setColor

public abstract void setColor(Color color)
Sets atom's color on a screen.

Parameters:
color - atom's color on a screen.

getName

public abstract String getName()
Returns atom's name. Always not null;

Returns:
atom's name.

getSerialNum

public abstract int getSerialNum()
Returns atom's serial number.

Returns:
atom's serial number.

setSerialNum

public abstract void setSerialNum(int serial)
Sets atom's serial number.

Parameters:
serial - atom's serial number.

getAlternative

public abstract char getAlternative()
Returns atom's alternate location indicator.

Returns:
atom's alternate location indicator.

setAlternative

public abstract void setAlternative(char altern)
Sets atom's alternate location indicator.

Parameters:
altern - atom's alternate location indicator.

getOccupancy

public abstract double getOccupancy()
Returns atom's occupancy.

Returns:
atom's occupancy.

setOccupancy

public abstract void setOccupancy(double occup)
Sets atom's occupancy.

Parameters:
occup - atom's occupancy.

getTemperature

public abstract double getTemperature()
Returns atom's temperature factor.

Returns:
atom's temperature factor.

setTemperature

public abstract void setTemperature(double temper)
Sets atom's temperature factor.

Parameters:
temper - atom's temperature factor.

getElement

public abstract Element getElement()
Returns atom's chemical element.

Returns:
atom's chemical element.

isSelected

public abstract boolean isSelected()
Returns atom's selection status.

Returns:
atom's selection status.

setSelected

public abstract void setSelected(boolean val)
Sets atom's selection status.

Parameters:
val - atom's selection status.

isCA

public abstract boolean isCA()
Returns 'true' if atom is alpha carbon, 'false' otherwise.

Returns:
'true' if atom is alpha carbon, 'false' otherwise.

isC

public abstract boolean isC()
Returns 'true' if atom is carbon of mainchain, 'false' otherwise.

Returns:
'true' if atom is carbon of mainchain, 'false' otherwise.

isN

public abstract boolean isN()
Returns 'true' if atom is nitrogen of mainchain, 'false' otherwise.

Returns:
'true' if atom is nitrogen of mainchain, 'false' otherwise.

isO

public abstract boolean isO()
Returns 'true' if atom is oxygen of mainchain, 'false' otherwise.

Returns:
'true' if atom is oxygen of mainchain, 'false' otherwise.

isCB

public abstract boolean isCB()
Returns 'true' if atom is CB carbon, 'false' otherwise.

Returns:
'true' if atom is CB carbon, 'false' otherwise.

getSelectedAttribute

public static int getSelectedAttribute()
Returns flag attribute for selected atom.

Returns:
flag attribute for selected atom.

hasAttribute

public abstract boolean hasAttribute(int att)
Returns true if the provide attribute matches to the attributes of the atom.

Returns:
true if the provide attribute matches to the attributes of the atom.

distanceTo

public abstract double distanceTo(Atom atom)
Returns distance to the given atom.

Returns:
distance to the given atom.

distance2To

public abstract double distance2To(Atom atom)
Returns squared distance to the given atom.

Returns:
squared distance to the given atom.

toString

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

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

scaleToPixels

public static double scaleToPixels()
Returns scale used to transform atomic coordinates to pixel coordiantes.

Returns:
scale used to transform atomic coordinates to pixel coordiantes.