Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.xmlcml.simplecml
Class SimpleMolecule  view SimpleMolecule download SimpleMolecule.java

java.lang.Object
  extended byorg.xmlcml.simplecml.SimpleMolecule

public class SimpleMolecule
extends java.lang.Object

SimpleMolecule manages a subset of CML functionality for molecules. It lacks many of the more sophisticated methods and exposes the atoms and bonds as public vectors It should only be used with SimpleBond and SimpleAtom.

Typical code:

	SimpleMolecule mol = new SimpleMolecule();
	SimpleAtom atom1 = new SimpleAtom();
	atom1.elementType="C";
	atom1.id="c1";
	atomVector.addElement(atom1);
	SimpleAtom atom2 = new SimpleAtom();
	atom2.elementType="O";
	atom2.id="o2";
	atomVector.addElement(atom2);
	SimpleBond bond = new SimpleBond();
	bond.atomRef1 = atom1;
	bond.atomRef2 = atom2;
	bond.order = "T";
	bondVector.addElement(bond);
	


Field Summary
(package private)  java.util.Hashtable atomTable
           
 java.util.Vector atomVector
          Vector of atoms in molecules; initially set to new Vector()
 java.util.Vector bondVector
          Vector of bonds in molecules; initially set to new Vector()
static java.lang.String CML_DTD_NAMESPACE_URI
          definitive namespace URI for CML V1.0
static java.lang.String CML_SCHEMA_NAMESPACE_URI
          definitive namespace URI for CML V2.0 (Schema)
 java.lang.String id
          unique ID for molecule
 java.util.Vector moleculeVector
          Vector of child molecules; initially set to new Vector()
 java.lang.String namespace
          output namespace (default = CML1.0 DTD)
 int natoms
          atom count in molecule; updated by addAtom()
 int nbonds
          bond count in molecule; updated by addBond()
 int nmolecules
          count of child molecules;
 
Constructor Summary
SimpleMolecule()
          constructs a SimpleMolecule with new Vectors and zero counts
 
Method Summary
 void addAtom(SimpleAtom atom)
          add atom; updates count
 void addBond(SimpleBond bond)
          add bond; updates count
 void addMolecule(SimpleMolecule molecule)
          add molecule; updates count
(package private) static java.lang.String getPrefix(java.lang.String prefix)
          return namespace prefix
 void setNamespace(java.lang.String namespace)
          set flag to decide on CML-DTD (V1) or CML-Schema (V2)
 java.lang.String toCML()
          default: no decl, no encoding, no dtd, useNamespace, no prefix, no arrays
 java.lang.String toCML(boolean useDecl, java.lang.String encoding, java.lang.String dtd, java.lang.String namespace, java.lang.String prefix, boolean arrayx)
           
 java.lang.String toString()
          diagnostic string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CML_DTD_NAMESPACE_URI

public static final java.lang.String CML_DTD_NAMESPACE_URI
definitive namespace URI for CML V1.0

See Also:
Constant Field Values

CML_SCHEMA_NAMESPACE_URI

public static final java.lang.String CML_SCHEMA_NAMESPACE_URI
definitive namespace URI for CML V2.0 (Schema)

See Also:
Constant Field Values

atomVector

public java.util.Vector atomVector
Vector of atoms in molecules; initially set to new Vector()


bondVector

public java.util.Vector bondVector
Vector of bonds in molecules; initially set to new Vector()


moleculeVector

public java.util.Vector moleculeVector
Vector of child molecules; initially set to new Vector()


id

public java.lang.String id
unique ID for molecule


natoms

public int natoms
atom count in molecule; updated by addAtom()


nbonds

public int nbonds
bond count in molecule; updated by addBond()


nmolecules

public int nmolecules
count of child molecules;


namespace

public java.lang.String namespace
output namespace (default = CML1.0 DTD)


atomTable

java.util.Hashtable atomTable
Constructor Detail

SimpleMolecule

public SimpleMolecule()
constructs a SimpleMolecule with new Vectors and zero counts

Method Detail

toString

public java.lang.String toString()
diagnostic string


setNamespace

public void setNamespace(java.lang.String namespace)
set flag to decide on CML-DTD (V1) or CML-Schema (V2)


toCML

public java.lang.String toCML()
default: no decl, no encoding, no dtd, useNamespace, no prefix, no arrays


toCML

public java.lang.String toCML(boolean useDecl,
                              java.lang.String encoding,
                              java.lang.String dtd,
                              java.lang.String namespace,
                              java.lang.String prefix,
                              boolean arrayx)

getPrefix

static java.lang.String getPrefix(java.lang.String prefix)
return namespace prefix


addAtom

public void addAtom(SimpleAtom atom)
add atom; updates count


addBond

public void addBond(SimpleBond bond)
add bond; updates count


addMolecule

public void addMolecule(SimpleMolecule molecule)
add molecule; updates count