org.xmlcml.cml
Interface Molecule

All Known Implementing Classes:
MoleculeImpl

public interface Molecule
extends CMLBase, HasCount, HasExecute

Molecule is the basic container for Atoms, Bonds, Electrons Angles, Torsion, Sequences, Features, Crystal and other objects. Molecules may contain other Molecules. When objects such as AtomArray are set or added they are deep-copied, to avoid unpleasant surprises later. In general Atom, AtomArray, Bond, BondArray should not be shared between different molecules. A molecule has only one set of Atoms and Bonds - if a molecule is created with AtomArray and an Atom is subsequently added, the components are effectively merged.


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 org.xmlcml.cml.HasCount
COUNT
 
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
 
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
 
Method Summary
 void addAngle(Angle angle)
          adds the Angle to the Angle content of the Molecule.
 void addAtom(Atom atom)
          adds the Atom to the Atom content of the Molecule.
 void addBond(Bond bond)
          adds the Bond to the Bond content of the Molecule.
 void addElectron(Electron electron)
          Adds a Electron to the Molecule content.
 void addFeature(Feature feature)
          Adds a Feature to the Molecule content.
 void addMolecule(Molecule molecule)
          Adds a Molecule to the Molecule content.
 void addSequence(Sequence sequence)
          Adds a Sequence to the Molecule content.
 void addTorsion(Torsion torsion)
          adds the Torsion to the Torsion content of the Molecule.
 void deleteAngle(Angle angle)
          deletes the Angle from the Angle content of the Molecule.
 void deleteAtom(Atom atom)
          deletes the Atom from the Atom content of the Molecule.
 void deleteBond(Bond bond)
          deletes the Bond from the Bond content of the Molecule.
 void deleteElectron(Electron electron)
          Deletes a Electron from the Molecule content.
 void deleteFeature(Feature feature)
          Deletes a Feature from the Molecule content.
 void deleteMolecule(Molecule molecule)
          Deletes a Molecule from the Molecule content.
 void deleteSequence(Sequence sequence)
          Deletes a Sequence from the Molecule content.
 void deleteTorsion(Torsion torsion)
          deletes the Torsion from the Torsion content of the Molecule.
 java.util.Vector getAngleVector()
          extracts ALL the Angles as a Vector
 AtomArray getAtomArray()
          packs current Atoms into an AtomArray
 Atom getAtomById(java.lang.String id)
           
 int getAtomCount()
           
 java.util.Hashtable getAtomIdTable()
           
 java.util.Vector getAtomVector()
          extracts ALL the Atoms as a Vector
 Bond getBond(Atom atom1, Atom atom2)
          get a bond from the atoms - order is irrelevant
 BondArray getBondArray()
          extracts ALL the bonds in a single BondArray.
 int getBondCount()
           
 java.util.Vector getBondVector()
          extracts ALL the Bonds as a Vector
 double getCount()
           
 Crystal getCrystal()
          extracts Crystal if present
 java.util.Vector getElectronVector()
          extracts ALL the Electrons as a Vector
 Feature getFeature()
          extracts the FIRST Feature if any present
 java.util.Vector getFeatureVector()
          extracts ALL the Features as a Vector
 java.util.Vector getMoleculeVector()
          extracts ALL the Molecules as a Vector
 Sequence getSequence()
          extracts the FIRST Sequence if any present
 java.util.Vector getSequenceVector()
          extracts ALL the Sequences as a Vector
 java.util.Vector getTorsionVector()
          extracts ALL the Torsions as a Vector
 void run(Execute execute)
          run an <execute> child
 void setCount(double count)
           
 void setCrystal(Crystal crystal)
          replaces Crystal information; if null, deletes any existing Crystal
 
Methods inherited from interface org.xmlcml.cml.HasCount
updateDOMHasCount
 

Method Detail

run

public void run(Execute execute)
         throws java.lang.Exception
run an <execute> child
Specified by:
run in interface HasExecute

getAtomArray

public AtomArray getAtomArray()
packs current Atoms into an AtomArray
Returns:
AtomArray the atoms; empty AtomArray if none

addAtom

public void addAtom(Atom atom)
             throws CMLException
adds the Atom to the Atom content of the Molecule. The atom is shallow-copied. if the Atom belongs to another Molecule it is deleted from it

deleteAtom

public void deleteAtom(Atom atom)
                throws CMLException
deletes the Atom from the Atom content of the Molecule. If is in a different Molecule or is null, no action. NOTE: At present this does NOT check the validity of the Molecule after deletion. At present the calling program must examine the Bonds, Torsions, etc.
Parameters:
Atom - atom to be deleted
Throws:
CMLException - atom does not belong to this molecule

getAtomVector

public java.util.Vector getAtomVector()
extracts ALL the Atoms as a Vector
Returns:
Vector empty Vector if no atoms

getAtomIdTable

public java.util.Hashtable getAtomIdTable()

getAtomById

public Atom getAtomById(java.lang.String id)

getAtomCount

public int getAtomCount()

getBondArray

public BondArray getBondArray()
extracts ALL the bonds in a single BondArray.
Returns:
BondArray the bonds; empty BondArray if none

addBond

public void addBond(Bond bond)
             throws CMLException
adds the Bond to the Bond content of the Molecule. The bond is shallow-copied

deleteBond

public void deleteBond(Bond bond)
                throws CMLException
deletes the Bond from the Bond content of the Molecule. If bond does not exist, no action. If bond is in no Molecule or is in a different Molecule, throws Exception r
Throws:
CMLException - bond does not belong to this Molecule

getBondVector

public java.util.Vector getBondVector()
extracts ALL the Bonds as a Vector
Returns:
Vector empty Vector if no bonds

getBond

public Bond getBond(Atom atom1,
                    Atom atom2)
get a bond from the atoms - order is irrelevant
Parameters:
Atom - atom1 first atom
Atom - atom2 other atom

getBondCount

public int getBondCount()

addAngle

public void addAngle(Angle angle)
adds the Angle to the Angle content of the Molecule. The angle is shallow-copied

deleteAngle

public void deleteAngle(Angle angle)
deletes the Angle from the Angle content of the Molecule. If angle does not exist, or is in a different Molecule or is null, no action.

getAngleVector

public java.util.Vector getAngleVector()
extracts ALL the Angles as a Vector
Returns:
Vector empty Vector if no angles

addTorsion

public void addTorsion(Torsion torsion)
adds the Torsion to the Torsion content of the Molecule. The torsion is shallow-copied

deleteTorsion

public void deleteTorsion(Torsion torsion)
deletes the Torsion from the Torsion content of the Molecule. If torsion does not exist, or is in a different Molecule or is null, no action.

getTorsionVector

public java.util.Vector getTorsionVector()
extracts ALL the Torsions as a Vector
Returns:
Vector empty Vector if no torsions

getCrystal

public Crystal getCrystal()
extracts Crystal if present
Returns:
Crystal. null if none

setCrystal

public void setCrystal(Crystal crystal)
replaces Crystal information; if null, deletes any existing Crystal
Parameters:
Crystal - the crystallographic information

getSequence

public Sequence getSequence()
extracts the FIRST Sequence if any present
Returns:
Sequence. null if none

addSequence

public void addSequence(Sequence sequence)
Adds a Sequence to the Molecule content.
Parameters:
Sequence - the sequence to be added. null is ignored

deleteSequence

public void deleteSequence(Sequence sequence)
Deletes a Sequence from the Molecule content.
Parameters:
Sequence - the sequence to be deleted. null is ignored

getSequenceVector

public java.util.Vector getSequenceVector()
extracts ALL the Sequences as a Vector
Returns:
Vector empty Vector if no Sequences

getFeature

public Feature getFeature()
extracts the FIRST Feature if any present
Returns:
Feature. null if none

addFeature

public void addFeature(Feature feature)
Adds a Feature to the Molecule content.
Parameters:
Feature - the feature to be added. null is ignored

deleteFeature

public void deleteFeature(Feature feature)
Deletes a Feature from the Molecule content.
Parameters:
Feature - the feature to be deleted. null is ignored

getFeatureVector

public java.util.Vector getFeatureVector()
extracts ALL the Features as a Vector
Returns:
Vector empty Vector if no Features

addElectron

public void addElectron(Electron electron)
Adds a Electron to the Molecule content.
Parameters:
Electron - the electron to be added. null is ignored

deleteElectron

public void deleteElectron(Electron electron)
Deletes a Electron from the Molecule content.
Parameters:
Electron - the electron to be deleted. null is ignored

getElectronVector

public java.util.Vector getElectronVector()
extracts ALL the Electrons as a Vector
Returns:
Vector empty Vector if no Electrons

addMolecule

public void addMolecule(Molecule molecule)
Adds a Molecule to the Molecule content.
Parameters:
Molecule - the molecule to be added. null is ignored

deleteMolecule

public void deleteMolecule(Molecule molecule)
Deletes a Molecule from the Molecule content.
Parameters:
Molecule - the molecule to be deleted. null is ignored

getMoleculeVector

public java.util.Vector getMoleculeVector()
extracts ALL the Molecules as a Vector
Returns:
Vector empty Vector if no Molecules

setCount

public void setCount(double count)
Specified by:
setCount in interface HasCount

getCount

public double getCount()
Specified by:
getCount in interface HasCount