org.proteinshader.structure
Class Bond

java.lang.Object
  extended by org.proteinshader.structure.Drawable
      extended by org.proteinshader.structure.Bond
All Implemented Interfaces:
Visitable

public class Bond
extends Drawable

Extends abstract class Drawable to add data that is unique to a bond between two atoms.

The xyz-coordinates for the center of the bond are specified in Drawable. All Drawables must have a position for their center, so that they can be sorted by their distance from the camera. The xyz-coordinates at each end of a bond must be found by going to the src (source) or dst (destination) atom for the bond.

For non-standard groups (heterogens), the bonds between atoms are specified in the CONECT records near the end of a PDB formatted file. For a standard group such as an amino acid, the connectivity is implied by the name of the amino acid.


Field Summary
 
Fields inherited from class org.proteinshader.structure.Drawable
DEFAULT_ALPHA, DEFAULT_BLUE, DEFAULT_GREEN, DEFAULT_RADIUS, DEFAULT_RED, DEFAULT_SPECULAR_EXP
 
Constructor Summary
Bond(Atom srcAtom, Atom dstAtom, BondEnum type, VisibilityEnum visibility)
          Constructs a Bond for the source and destination Atoms given as arguments.
 
Method Summary
 void accept(Visitor visitor)
          Accepts a Visitor and does a callback.
 double getDirX()
          Returns the x-coordinate of the source to destination Atom direction vector.
 double getDirY()
          Returns the y-coordinate of the source to destination Atom direction vector.
 double getDirZ()
          Returns the z-coordinate of the source to destination Atom direction vector.
 Atom getDstAtom()
          Returns the destination Atom for this Bond.
 double getDstDirX()
          Returns the x-coordinate of the center to destination Atom direction vector.
 double getDstDirY()
          Returns the y-coordinate of the center to destination Atom direction vector.
 double getDstDirZ()
          Returns the z-coordinate of the center to destination Atom direction vector.
 double getHalfLength()
          Returns the half-length of the Bond in angstroms.
 double getLength()
          Returns the length of the Bond in angstroms.
 Segment getSegment()
          Returns the Segment the Bond is associated with (or null if the Bond is not associated with any Segment).
 Atom getSrcAtom()
          Returns the source Atom for this Bond.
 double getSrcDirX()
          Returns the x-coordinate of the center to source Atom direction vector.
 double getSrcDirY()
          Returns the y-coordinate of the center to source Atom direction vector.
 double getSrcDirZ()
          Returns the z-coordinate of the center to source Atom direction vector.
 BondEnum getType()
          Returns the Bond's type as an enum (SINGLE, DOUBLE, PEPTIDE, etc.).
 void setColorToDefault()
          Uses the Bond type to set the Drawable color to the default CPK color value specified in BondEnum.
 void setRadiusToDefault()
          Uses the Bond type to set the radius to the default radius specified in BondEnum.
 void setSegment(Segment s)
          Sets the Segment the Bond is associated with.
 void setType(BondEnum type)
          Sets the Bond's type as an enum (SINGLE, DOUBLE, PEPTIDE, etc.).
 String toString()
          Returns a String with the IDs of the source and destination atoms.
 
Methods inherited from class org.proteinshader.structure.Drawable
distance, getAlpha, getAngstromsPerPixel, getBlue, getCameraDepth, getCameraDistance, getColor, getDrawableType, getGreen, getPoint, getRadius, getRed, getSpecularExp, getTranslation, getVisibility, getX, getY, getZ, minus, scaleRadius, setAlpha, setAlphaToDefault, setAngstromsPerPixel, setCameraDepth, setCameraDistance, setColor, setColor, setColor, setRadius, setRGBAToDefault, setRGBToDefault, setSpecularExp, setSpecularExpToDefault, setVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Bond

public Bond(Atom srcAtom,
            Atom dstAtom,
            BondEnum type,
            VisibilityEnum visibility)
Constructs a Bond for the source and destination Atoms given as arguments. The srcAtom and dstAtom coordinates are used to calculate the center of the Bond. Therefore, a null pointer exception will be thrown if srcAtom or dstAtom are null. The depth is set to 0.0 by default for all Drawables. If type is null, BondEnum.SINGLE will be used as a default. The BondEnum type is used to determine the default radius and default color.

Parameters:
srcAtom - the source Atom for this Bond.
dstAtom - the destination Atom for this Bond.
type - the type of Bond (SINGLE, DOUBLE, etc. )
visibility - visibility status (OPAQUE, TRANSLUCENT, INVISIBLE)
Throws:
NullPointerException - if srcAtom or dstAtom is null.
Method Detail

accept

public void accept(Visitor visitor)
            throws VisitorException
Accepts a Visitor and does a callback.

Specified by:
accept in interface Visitable
Specified by:
accept in class Drawable
Parameters:
visitor - the Visitor to do a callback with.
Throws:
VisitorException - if an error occurs while an object is being visited.

getSrcAtom

public Atom getSrcAtom()
Returns the source Atom for this Bond. The source Atom is a read-only attribute set by the constructor. It cannot be null, because the constructor would have thrown a NullPointerException.

Returns:
The source Atom.

getDstAtom

public Atom getDstAtom()
Returns the destination Atom for this Bond. The destination Atom is a read-only attribute set by the constructor. It cannot be null, because the constructor would have thrown a NullPointerException.

Returns:
The destination Atom.

getType

public BondEnum getType()
Returns the Bond's type as an enum (SINGLE, DOUBLE, PEPTIDE, etc.).

Returns:
The type as a BondEnum.

getDirX

public double getDirX()
Returns the x-coordinate of the source to destination Atom direction vector.

Returns:
The source to destination direction vector x-coordinate.

getDirY

public double getDirY()
Returns the y-coordinate of the source to destination Atom direction vector.

Returns:
The source to destination direction vector y-coordinate.

getDirZ

public double getDirZ()
Returns the z-coordinate of the source to destination Atom direction vector.

Returns:
The source to destination direction vector z-coordinate.

getSrcDirX

public double getSrcDirX()
Returns the x-coordinate of the center to source Atom direction vector.

Returns:
The center to source direction vector x-coordinate.

getSrcDirY

public double getSrcDirY()
Returns the y-coordinate of the center to source Atom direction vector.

Returns:
The center to source direction vector y-coordinate.

getSrcDirZ

public double getSrcDirZ()
Returns the z-coordinate of the center to source Atom direction vector.

Returns:
The center to source direction vector z-coordinate.

getDstDirX

public double getDstDirX()
Returns the x-coordinate of the center to destination Atom direction vector.

Returns:
The center to destination direction vector x-coordinate.

getDstDirY

public double getDstDirY()
Returns the y-coordinate of the center to destination Atom direction vector.

Returns:
The center to destination direction vector y-coordinate.

getDstDirZ

public double getDstDirZ()
Returns the z-coordinate of the center to destination Atom direction vector.

Returns:
The center to destination direction vector z-coordinate.

getHalfLength

public double getHalfLength()
Returns the half-length of the Bond in angstroms.

Returns:
The half-length of the Bond.

getLength

public double getLength()
Returns the length of the Bond in angstroms.

Returns:
The length of the Bond.

getSegment

public Segment getSegment()
Returns the Segment the Bond is associated with (or null if the Bond is not associated with any Segment).

Returns:
The associated Segment (or null).

setSegment

public void setSegment(Segment s)
Sets the Segment the Bond is associated with.

Parameters:
s - the Segment.

setType

public void setType(BondEnum type)
Sets the Bond's type as an enum (SINGLE, DOUBLE, PEPTIDE, etc.). If type is null, BondEnum.SINGLE will be used as a default.

Parameters:
type - the Bond's type.

setRadiusToDefault

public void setRadiusToDefault()
Uses the Bond type to set the radius to the default radius specified in BondEnum.

Overrides:
setRadiusToDefault in class Drawable

setColorToDefault

public void setColorToDefault()
Uses the Bond type to set the Drawable color to the default CPK color value specified in BondEnum.


toString

public String toString()
Returns a String with the IDs of the source and destination atoms.

Overrides:
toString in class Object
Returns:
IDs of the source and destination Atoms.


Copyright © 2007-2008