JavaGenes, NASA Ames. Written largely by Al Globus

gov.nasa.javaGenes.chemistry
Class Atom

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

public class Atom
extends Vertex

Represent a chemical atom.

See Also:
Serialized Form

Nested Class Summary
protected static class Atom.ExtendedTypeKey
          Represents the extended type of this atom for use as a hashtable key.
 
Field Summary
protected  Element element
           
 
Fields inherited from class gov.nasa.javaGenes.graph.Vertex
edges, extendedTypeCache, number, xyz
 
Constructor Summary
Atom(Atom atom)
           
Atom(Element e)
           
Atom(int number)
           
Atom(java.lang.String symbol)
           
 
Method Summary
 int bondValenceSum()
          What portion of the valence is used by existing bonds?
 boolean canAcceptEdge()
          Will adding another bond exceed valence?
 boolean canAcceptEdge(Edge e)
          Will attaching to this bond exceed valence?
 boolean canAcceptEdgesOf(Vertex v)
          can all of the edges of v be connected to this?
 int getAtomicNumber()
           
 Bond getBond(int i)
          Return the i'th bond
 java.lang.Object getExtendedTypeObject()
          returns a ExtendedTypeKey (a internal class) to represent the extended type of this atom, usually as a hashtable key.
 java.lang.String getExtendedTypeString()
          Create a string to represent the extended type of this atom.
 int getValence()
          Return the valence of this element
 boolean isElement(java.lang.String symbol)
           
 boolean isIn(Atom[] array)
           
 boolean isSame(Vertex v)
          is v exactly this?
 int remainingValence()
          return the amount of valence unused by existing bonds
 java.lang.String toString()
           
 void translateWithNeighbors(Vector3d translation, Atom[] keepStationary)
           
 
Methods inherited from class gov.nasa.javaGenes.graph.Vertex
add, clone, getAngleBetween, getDistanceTo, getEdge, getEdgeIterator, getLocationVector, getNumber, getTypeString, getXyz, hasEdgeTo, moveInsideInterval, removeEdge, scaleBy, setNumber, setXyz, setXyz, shallowCopyVertex, stateChange, stealEdges, translate, walkAll, walkVertices
 
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

element

protected Element element
Constructor Detail

Atom

public Atom(int number)

Atom

public Atom(Element e)

Atom

public Atom(java.lang.String symbol)

Atom

public Atom(Atom atom)
Method Detail

isElement

public boolean isElement(java.lang.String symbol)

translateWithNeighbors

public void translateWithNeighbors(Vector3d translation,
                                   Atom[] keepStationary)

isIn

public boolean isIn(Atom[] array)

canAcceptEdge

public boolean canAcceptEdge()
Will adding another bond exceed valence?

Overrides:
canAcceptEdge in class Vertex
Returns:
true if another edge can be added

canAcceptEdgesOf

public boolean canAcceptEdgesOf(Vertex v)
can all of the edges of v be connected to this?

Overrides:
canAcceptEdgesOf in class Vertex

canAcceptEdge

public boolean canAcceptEdge(Edge e)
Will attaching to this bond exceed valence?

Overrides:
canAcceptEdge in class Vertex
Parameters:
e - must be a Bond
Returns:
true. Subclasses should return true if Edge e can be added

bondValenceSum

public int bondValenceSum()
What portion of the valence is used by existing bonds?


isSame

public boolean isSame(Vertex v)
is v exactly this?

Overrides:
isSame in class Vertex

getExtendedTypeString

public java.lang.String getExtendedTypeString()
Create a string to represent the extended type of this atom. The extended type is the atomic symbol plus the number of single, double, and triple bonds.

Overrides:
getExtendedTypeString in class Vertex
Returns:
a string suitable as a hashtable key for the extended type of this vertex. The extended type is the type of the vertex (usually found in a subclass) and the types of all incident edges. The return value is cached for future use without recalculation.

getExtendedTypeObject

public java.lang.Object getExtendedTypeObject()
returns a ExtendedTypeKey (a internal class) to represent the extended type of this atom, usually as a hashtable key. The extended type is the atomic symbol plus the number of single, double, and triple bonds.

This provides an efficiency advantage over the String returned by getExtendedTypeString() but requires a little bit of care. Don't modify the returned object in any way. And ExtendedTypeKey is not thread safe

Overrides:
getExtendedTypeObject in class Vertex
Returns:
an object suitable as a hashtable key for the extended type of this vertex. The extended type is the type of the vertex (usually found in a subclass) and the types of all incident edges. Not currently implemented. Atom does implement this.
See Also:
Atom

remainingValence

public int remainingValence()
return the amount of valence unused by existing bonds


getValence

public int getValence()
Return the valence of this element


getAtomicNumber

public int getAtomicNumber()

getBond

public Bond getBond(int i)
Return the i'th bond


toString

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

JavaGenes, NASA Ames. Written largely by Al Globus