org.xmlcml.cml
Class AtomImpl

java.lang.Object
  |
  +--org.apache.xerces.dom.NodeImpl
        |
        +--org.apache.xerces.dom.ChildNode
              |
              +--org.apache.xerces.dom.ChildAndParentNode
                    |
                    +--org.apache.xerces.dom.ElementImpl
                          |
                          +--uk.co.demon.ursus.dom.AbstractElementImpl
                                |
                                +--uk.co.demon.ursus.dom.PMRElementImpl
                                      |
                                      +--org.xmlcml.cml.CMLBaseImpl
                                            |
                                            +--org.xmlcml.cml.AbstractBuiltinContainerImpl
                                                  |
                                                  +--org.xmlcml.cml.AbstractAtomImpl
                                                        |
                                                        +--org.xmlcml.cml.AtomImpl

public class AtomImpl
extends AbstractAtomImpl
implements Atom

See Also:
Serialized Form

Field Summary
protected  double atomParity
           
protected  java.util.Vector atomRefVector
          Vector of Objects than refer to this Atom
protected  java.lang.String elementType
           
protected  int formalCharge
           
protected  int hybridization
           
protected  int hydrogenCount
           
protected  double isotope
           
protected  java.util.Vector ligandVector
           
protected  Molecule molecule
          Atom know which molecule it belongs to.
protected  int nonHydrogenCount
           
protected  double occupancy
           
protected  java.lang.String residueID
           
protected  java.lang.String residueType
           
protected  Real2 xy2
           
protected  Point3 xyz3
           
protected  Point3 xyzFract
           
 
Fields inherited from class org.xmlcml.cml.AbstractAtomImpl
count
 
Fields inherited from class org.xmlcml.cml.AbstractBuiltinContainerImpl
builtinValues, nonBuiltinTable
 
Fields inherited from class org.xmlcml.cml.CMLBaseImpl
conventionName, conventionTable, dictRef, id, title, validity
 
Fields inherited from class uk.co.demon.ursus.dom.PMRElementImpl
CLASSNAME, processFlag
 
Fields inherited from class uk.co.demon.ursus.dom.AbstractElementImpl
CLASSNAME
 
Fields inherited from class org.apache.xerces.dom.ElementImpl
attributes, name
 
Fields inherited from class org.apache.xerces.dom.ChildAndParentNode
changes, firstChild, nodeListIndex, nodeListLength, nodeListNode, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, IGNORABLEWS, MUTATION_AGGREGATE, MUTATION_ALL, MUTATION_LOCAL, MUTATION_NONE, MUTATIONEVENTS, OWNED, ownerNode, READONLY, SETVALUE, SPECIFIED, SYNCCHILDREN, SYNCDATA
 
Fields inherited from interface org.xmlcml.cml.AbstractAtom
ATOM_BUILTIN_COUNT, ATOM_FLOATVAL_COUNT, ATOM_FLOATVAL_END, ATOM_FLOATVAL_START, ATOM_ID, ATOM_INTEGERVAL_COUNT, ATOM_INTEGERVAL_END, ATOM_INTEGERVAL_START, ATOM_PARITY_FLOAT, ATOM_PARITY_INT, ATOM_STRINGVAL_COUNT, ATOM_STRINGVAL_END, ATOM_STRINGVAL_START, ELEMENT_TYPE, FORMAL_CHARGE_FLOAT, FORMAL_CHARGE_INT, HYDROGEN_COUNT_FLOAT, HYDROGEN_COUNT_INT, ISOTOPE_FLOAT, ISOTOPE_INT, NON_HYDROGEN_COUNT_FLOAT, NON_HYDROGEN_COUNT_INT, OCCUPANCY, RESIDUE_ID, RESIDUE_TYPE, SMILESATOMS, SP, SP2, SP3, spTypeStrings, valences, X2, X3, XFRACT, Y2, Y3, YFRACT, Z3, ZFRACT
 
Fields inherited from interface org.xmlcml.cml.AbstractBuiltinContainer
NONUNIQUE, UNIQUE
 
Fields inherited from interface org.xmlcml.cml.HasCount
COUNT
 
Fields inherited from interface org.xmlcml.cml.CMLBase
ANGLE, ATOM, ATOMARRAY, BOND, BONDARRAY, BUILTIN, CML, CRYSTAL, ELECTRON, ELEMENT_COUNT, ELEMENT_NAMES, EXECUTE, FEATURE, FLOAT, FLOAT_TYPE, FLOATARRAY, FLOATMATRIX, FORMULA, INTEGER, INTEGER_TYPE, INTEGERARRAY, LINK, LIST, MOLECULE, PACKAGE_NAME, REACTION, SEQUENCE, STRING, STRING_TYPE, STRINGARRAY, TORSION, UNK, UNK_ELEM, UNKNOWN
 
Fields inherited from interface uk.co.demon.ursus.dom.PMRElement
CLASSNAME, LOCAL, QUALIFIED, UNIVERSAL
 
Fields inherited from interface org.xmlcml.cml.HasTitle
TITLE
 
Fields inherited from interface org.xmlcml.cml.HasDictRef
DICTREF
 
Fields inherited from interface org.xmlcml.cml.HasId
ID
 
Fields inherited from interface org.xmlcml.cml.HasConvention
CONVENTION
 
Fields inherited from interface uk.co.demon.ursus.dom.PMRNode
ATTRIBUTES, CONTENT, ELEMENTNAME, IDLIST, NESTED, NESTEDATTS, PACKAGENAME, PRETTY, SPLITFILES, STYLE, TAGGED, UNTAGGED, WHITESPACE, XMLCONTENT
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
protected AtomImpl()
           
  AtomImpl(org.w3c.dom.Document document)
           
  AtomImpl(org.w3c.dom.Element element)
           
  AtomImpl(Molecule molecule, java.lang.String id)
          create in molecule context - must have unique id.
 
Method Summary
 void addLigand(Atom ligand)
          add a ligand to atom, but do not create a bond.
 Bond createBondToLigand(Atom ligand)
          add ligand.
 void debug(java.io.Writer w)
          output debug info to Writer
 java.lang.String generateId(int serial)
          give each atom an ID.
 double getAtomParity()
           
 java.util.Vector getAtomRefVector()
          finds all references to this atom, e.g.
 java.lang.String getElementType()
          get elementType from builtin child
 int getFormalCharge()
           
 int getHybridization()
           
 int getHydrogenCount()
           
 java.lang.String getId()
          if ID attribute is missing, returns atomId biltin child value and sets ID attribute to this value
 double getIsotope()
           
 Atom getLigand(int i)
          convenience method to get element of ligand vector
 int getLigandCount()
          get ligand count
 java.util.Vector getLigandVector()
          get vector of ligands
 Molecule getMolecule()
          an atom may be associated with one Molecule (or none)
 int getNonHydrogenCount()
           
 double getOccupancy()
           
 java.lang.String getResidueID()
           
 java.lang.String getResidueType()
           
 Real2 getXY2()
           
 Point3 getXYZ3()
           
 Point3 getXYZFract()
           
 void plusXY2(Real2 r)
          increase XY2 coordinate; if atom.xy2 is null, sets coordinate to r
 void plusXYZ3(Point3 p)
          increase XYZ3 coordinate; if atom.xyz3 is null, sets coordinate to r
 void plusXYZFract(Point3 p)
          increase XYZFract coordinate; if atom.xyzFract is null, sets coordinate to p
 void processDOM()
          carries out class-specific processing for subclasses of PMRElement.
 void setAtomParity(double parity)
           
 void setElementType(java.lang.String elementType)
           
 void setFormalCharge(int formalCharge)
           
 void setHybridization(int hybridization)
           
 void setHydrogenCount(int hydrogenCount)
           
 void setIsotope(double isotope)
           
protected  void setMolecule(Molecule molecule)
           
 void setNonHydrogenCount(int nonHydrogenCount)
           
 void setOccupancy(double occupancy)
           
protected  void setRef(HasAtomRefs har)
          add a reference to this Atom
 void setResidueID(java.lang.String residueID)
           
 void setResidueType(java.lang.String residueType)
           
 void setXY2(double x2, double y2)
           
 void setXY2(Real2 xy2)
           
 void setXYZ3(double x3, double y3, double z3)
           
 void setXYZ3(Point3 xyz3)
           
 void setXYZFract(double x3, double y3, double z3)
           
 void setXYZFract(Point3 xyzFract)
           
 java.lang.String toString()
           
 void transform(Transform2 t2)
          transforms 2D coordinates of atom
 void updateDOM()
           
 
Methods inherited from class org.xmlcml.cml.AbstractAtomImpl
getBuiltinCount, getBuiltinFloatValCount, getBuiltinFloatValNames, getBuiltinIntegerValCount, getBuiltinIntegerValNames, getBuiltinNames, getBuiltinStringValCount, getBuiltinStringValNames, getCount, getValidity, setCount, showBuiltinNames, updateDOMHasCount
 
Methods inherited from class org.xmlcml.cml.AbstractBuiltinContainerImpl
addBuiltinChildWithFloatValue, addBuiltinChildWithIntegerValue, addBuiltinChildWithStringValue, checkBuiltins, deleteNonBuiltinVal, getBuiltinChildElements, getBuiltinChildFloatValue, getBuiltinChildIntegerValue, getBuiltinChildStringValue, getBuiltinVal, getNonBuiltinVal, setBuiltinVal, setNonBuiltinVal
 
Methods inherited from class org.xmlcml.cml.CMLBaseImpl
addValidity, convertToSubclass, getConventionName, getDictRef, getSubClassedElement, getTitle, help, isValid, main, setConventionName, setDictRef, setId, setTitle, showElementNames, test1, updateDOMHasConvention, updateDOMHasConvention, updateDOMHasCount, updateDOMHasDictRef, updateDOMHasDictRef, updateDOMHasId, updateDOMHasId, updateDOMHasTitle, updateDOMHasTitle, updateDOMHasUnits
 
Methods inherited from class uk.co.demon.ursus.dom.PMRElementImpl
appendTo, initialise, processDescendants, setProcessFlag
 
Methods inherited from class uk.co.demon.ursus.dom.AbstractElementImpl
setTagName
 
Methods inherited from class org.apache.xerces.dom.ElementImpl
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, getTagName, hasAttribute, hasAttributeNS, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setReadOnly, setupDefaultAttributes, synchronizeData
 
Methods inherited from class org.apache.xerces.dom.ChildAndParentNode
changed, changes, getChildNodes, getFirstChild, getLastChild, getLength, getOwnerDocument, hasChildNodes, insertBefore, item, removeChild, replaceChild, synchronizeChildren, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, dispatchEvent, finalize, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, removeEventListener, setNodeValue, setPrefix, setUserData, supports
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ligandVector

protected java.util.Vector ligandVector

molecule

protected Molecule molecule
Atom know which molecule it belongs to. This MUST correspond to the parent element. The programmer must maintain this

atomRefVector

protected java.util.Vector atomRefVector
Vector of Objects than refer to this Atom

xy2

protected Real2 xy2

xyz3

protected Point3 xyz3

xyzFract

protected Point3 xyzFract

elementType

protected java.lang.String elementType

occupancy

protected double occupancy

isotope

protected double isotope

formalCharge

protected int formalCharge

hydrogenCount

protected int hydrogenCount

nonHydrogenCount

protected int nonHydrogenCount

atomParity

protected double atomParity

residueType

protected java.lang.String residueType

residueID

protected java.lang.String residueID

hybridization

protected int hybridization
Constructor Detail

AtomImpl

protected AtomImpl()

AtomImpl

public AtomImpl(Molecule molecule,
                java.lang.String id)
         throws CMLException
create in molecule context - must have unique id. calls addAtom

AtomImpl

public AtomImpl(org.w3c.dom.Element element)

AtomImpl

public AtomImpl(org.w3c.dom.Document document)
Method Detail

getMolecule

public Molecule getMolecule()
Description copied from interface: Atom
an atom may be associated with one Molecule (or none)
Specified by:
getMolecule in interface Atom

setMolecule

protected void setMolecule(Molecule molecule)

getAtomRefVector

public java.util.Vector getAtomRefVector()
finds all references to this atom, e.g. from Bonds, Angles, Torsions, who must register this information
Specified by:
getAtomRefVector in interface Atom

setRef

protected void setRef(HasAtomRefs har)
add a reference to this Atom
Parameters:
HasAtomRefs - har bond, angle, etc. which references this atom

getXY2

public Real2 getXY2()
Specified by:
getXY2 in interface Atom

getXYZ3

public Point3 getXYZ3()
Specified by:
getXYZ3 in interface Atom

getXYZFract

public Point3 getXYZFract()
Specified by:
getXYZFract in interface Atom

setXY2

public void setXY2(double x2,
                   double y2)
Specified by:
setXY2 in interface Atom

setXY2

public void setXY2(Real2 xy2)
Specified by:
setXY2 in interface Atom

setXYZ3

public void setXYZ3(double x3,
                    double y3,
                    double z3)
Specified by:
setXYZ3 in interface Atom

setXYZ3

public void setXYZ3(Point3 xyz3)
Specified by:
setXYZ3 in interface Atom

setXYZFract

public void setXYZFract(double x3,
                        double y3,
                        double z3)
Specified by:
setXYZFract in interface Atom

setXYZFract

public void setXYZFract(Point3 xyzFract)
Specified by:
setXYZFract in interface Atom

getOccupancy

public double getOccupancy()
                    throws CMLException
Specified by:
getOccupancy in interface Atom

setOccupancy

public void setOccupancy(double occupancy)
Specified by:
setOccupancy in interface Atom

getIsotope

public double getIsotope()
                  throws CMLException
Specified by:
getIsotope in interface Atom

setIsotope

public void setIsotope(double isotope)
Specified by:
setIsotope in interface Atom

getFormalCharge

public int getFormalCharge()
                    throws CMLException
Specified by:
getFormalCharge in interface Atom

setFormalCharge

public void setFormalCharge(int formalCharge)
Specified by:
setFormalCharge in interface Atom

getHydrogenCount

public int getHydrogenCount()
                     throws CMLException
Specified by:
getHydrogenCount in interface Atom

setHydrogenCount

public void setHydrogenCount(int hydrogenCount)
Specified by:
setHydrogenCount in interface Atom

getNonHydrogenCount

public int getNonHydrogenCount()
                        throws CMLException
Specified by:
getNonHydrogenCount in interface Atom

setNonHydrogenCount

public void setNonHydrogenCount(int nonHydrogenCount)
Specified by:
setNonHydrogenCount in interface Atom

getAtomParity

public double getAtomParity()
                     throws CMLException
Specified by:
getAtomParity in interface Atom

setAtomParity

public void setAtomParity(double parity)
Specified by:
setAtomParity in interface Atom

getElementType

public java.lang.String getElementType()
                                throws CMLException
get elementType from builtin child
Specified by:
getElementType in interface Atom

setElementType

public void setElementType(java.lang.String elementType)
Specified by:
setElementType in interface Atom

getHybridization

public int getHybridization()
                     throws CMLException
Specified by:
getHybridization in interface Atom

setHybridization

public void setHybridization(int hybridization)
Specified by:
setHybridization in interface Atom

getResidueType

public java.lang.String getResidueType()
                                throws CMLException
Specified by:
getResidueType in interface Atom

setResidueType

public void setResidueType(java.lang.String residueType)
Specified by:
setResidueType in interface Atom

getResidueID

public java.lang.String getResidueID()
                              throws CMLException
Specified by:
getResidueID in interface Atom

setResidueID

public void setResidueID(java.lang.String residueID)
Specified by:
setResidueID in interface Atom

generateId

public java.lang.String generateId(int serial)
give each atom an ID. Order is: id attribute, atomId builtin child, then serial
Specified by:
generateId in interface Atom

getId

public java.lang.String getId()
if ID attribute is missing, returns atomId biltin child value and sets ID attribute to this value
Overrides:
getId in class CMLBaseImpl

createBondToLigand

public Bond createBondToLigand(Atom ligand)
                        throws CMLException
add ligand. If already known, ignore. Else look for bond including atom/ligand. If not present, create default bond. return Bond
Specified by:
createBondToLigand in interface Atom
Parameters:
Atom - ligand the ligand
Returns:
Bond the new bond

addLigand

public void addLigand(Atom ligand)
add a ligand to atom, but do not create a bond. If already present, no-op
Specified by:
addLigand in interface Atom
Parameters:
Atom - ligand to add

getLigandVector

public java.util.Vector getLigandVector()
get vector of ligands
Specified by:
getLigandVector in interface Atom
Returns:
Vector vector of Atoms (or null if none)

getLigandCount

public int getLigandCount()
get ligand count
Specified by:
getLigandCount in interface Atom
Returns:
int ligand count (0 or more)

getLigand

public Atom getLigand(int i)
Description copied from interface: Atom
convenience method to get element of ligand vector
Specified by:
getLigand in interface Atom

plusXY2

public void plusXY2(Real2 r)
increase XY2 coordinate; if atom.xy2 is null, sets coordinate to r
Specified by:
plusXY2 in interface Atom

transform

public void transform(Transform2 t2)
transforms 2D coordinates of atom
Specified by:
transform in interface Atom

plusXYZ3

public void plusXYZ3(Point3 p)
increase XYZ3 coordinate; if atom.xyz3 is null, sets coordinate to r
Specified by:
plusXYZ3 in interface Atom

plusXYZFract

public void plusXYZFract(Point3 p)
increase XYZFract coordinate; if atom.xyzFract is null, sets coordinate to p
Specified by:
plusXYZFract in interface Atom

processDOM

public void processDOM()
                throws CMLException
Description copied from interface: PMRElement
carries out class-specific processing for subclasses of PMRElement. The default for a generic PMRElement is no-op. Often creates an internal model
Overrides:
processDOM in class CMLBaseImpl
Tags copied from class: PMRElementImpl
Throws:
java.lang.Exception - these can be of many kinds and may include class-specific ones

toString

public java.lang.String toString()
Overrides:
toString in class org.apache.xerces.dom.NodeImpl

debug

public void debug(java.io.Writer w)
           throws java.io.IOException
output debug info to Writer
Overrides:
debug in class CMLBaseImpl
Parameters:
Writer - w output

updateDOM

public void updateDOM()
               throws CMLException
Overrides:
updateDOM in class AbstractAtomImpl