JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.chemistry
Class Bond

java.lang.Object
  extended bygov.nasa.alsUtility.Mark
      extended bygov.nasa.javaGenes.graph.GraphElement
          extended bygov.nasa.javaGenes.graph.Edge
              extended bygov.nasa.javaGenes.chemistry.Bond
All Implemented Interfaces:
java.lang.Cloneable, Compatible, java.io.Serializable

public class Bond
extends Edge

Represent a chemical bond. Note: class Molecule takes care of saving Bond state during a checkpoint and restoring it during a restore.

See Also:
Serialized Form

Field Summary
protected  int valence
           
 
Fields inherited from class gov.nasa.javaGenes.graph.Edge
vertices
 
Constructor Summary
Bond()
          create a single bond
Bond(Atom a1, Atom a2, int v)
          Create a bond between the two atoms.
Bond(int v)
          create a bond.
 
Method Summary
 boolean canAcceptVerticesOf(Edge e)
          can the atoms of the argument be connected by this bond (e)?
 boolean dissimilarEdgeCompatibleWithVertices(Edge e)
           
 Atom getAtom(int i)
           
 int getBondTypeIntegerCode()
          Return a value to be used as an array index (starting at 0).
static int getMaximumBondTypes()
          Return the highest number that can represent a bond type (3 for triple presently)
 int getValence()
          Return the amount of valence this bond uses
 boolean isCompatible(Compatible c)
          Is the argument a bond with the same order?
 boolean isSame(Edge e)
          is the type and valence of these bonds the same?
 void makeCompatibleWithVertices()
          Force the type (single, double, or triple) of this bond to be compatible with the valence of its atoms.
 void makeValenceCompatible()
          Force the type (single, double, or triple) of this bond to be compatible with the valence of its atoms.
 java.lang.String toString()
           
 
Methods inherited from class gov.nasa.javaGenes.graph.Edge
clone, commonVertex, doesConnect, getTypeString, getVertex, isLegal, otherVertex, removeVertices, replaceVertex, setVertices, shallowCopyEdge, stealVertices
 
Methods inherited from class gov.nasa.alsUtility.Mark
getMark, isMarked, setMark
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

valence

protected int valence
Constructor Detail

Bond

public Bond()
create a single bond


Bond

public Bond(int v)
create a bond. Argument v indicates single, double, or triple bond.


Bond

public Bond(Atom a1,
            Atom a2,
            int v)
Create a bond between the two atoms.

Parameters:
v - indicates single, double, or triple bond.
Method Detail

getAtom

public Atom getAtom(int i)

makeCompatibleWithVertices

public void makeCompatibleWithVertices()
Force the type (single, double, or triple) of this bond to be compatible with the valence of its atoms. Fail with an Error.assertTrue grants if this is impossible.

Overrides:
makeCompatibleWithVertices in class Edge

makeValenceCompatible

public void makeValenceCompatible()
Force the type (single, double, or triple) of this bond to be compatible with the valence of its atoms. Fail with an Error.assertTrue grants if this is impossible.


isCompatible

public boolean isCompatible(Compatible c)
Is the argument a bond with the same order?

Specified by:
isCompatible in interface Compatible
Overrides:
isCompatible in class Edge
Returns:
true if argument is same class

isSame

public boolean isSame(Edge e)
is the type and valence of these bonds the same?

Overrides:
isSame in class Edge

canAcceptVerticesOf

public boolean canAcceptVerticesOf(Edge e)
can the atoms of the argument be connected by this bond (e)?

Overrides:
canAcceptVerticesOf in class Edge
Parameters:
e - must be a Bond

dissimilarEdgeCompatibleWithVertices

public boolean dissimilarEdgeCompatibleWithVertices(Edge e)
Overrides:
dissimilarEdgeCompatibleWithVertices in class Edge
Parameters:
e - must be a Bond

getMaximumBondTypes

public static int getMaximumBondTypes()
Return the highest number that can represent a bond type (3 for triple presently)


getBondTypeIntegerCode

public int getBondTypeIntegerCode()
Return a value to be used as an array index (starting at 0).


getValence

public int getValence()
Return the amount of valence this bond uses


toString

public java.lang.String toString()
Overrides:
toString in class Edge

JavaGenes, NASA Ames. Written largely by Al Globus