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

Quick Search    Search Deep

org.xmlcml.cml
Interface CMLFormula  view CMLFormula download CMLFormula.java

All Superinterfaces:
AbstractBase, AbstractBuiltinContainer, AttributeConvention, AttributeCount, AttributeDictRef, AttributeId, AttributeTitle, BuiltinContainer, org.w3c.dom.Element, org.w3c.dom.Node

public interface CMLFormula
extends AbstractBase, AbstractBuiltinContainer, AttributeCount

CORE Interface
DTD Class
Semantics being developed. Will certainly manage element counts, recursive. Although not defined in the DTD, the data model corresponds to:

  <formula>
    <formula>
      <string builtin="elementType" count="2">Na
      <string builtin="elementType">S
      <string builtin="elementType" count="4">O
    </formula>
    <formula count="10">
      <string builtin="elementType" count="2">H
      <string builtin="elementType">O
    </formula>
  </formula>
which corresponds to Na2SO4.10H2O. The counts can be non-integer.


Field Summary
static java.lang.String ALPHABETIC_ELEMENTS
          sort alphabetically (output only)
static java.lang.String ANY
          any of the above (input only)
static java.lang.String[] builtinFloatValNames
           
static java.lang.String[] builtinIntegerValNames
           
static java.lang.String[] builtinStringValNames
           
static java.lang.String CHFIRST
          C H and then alphabetically (output only)
static java.lang.String ELEMENT_COUNT_WHITESPACE
          Example "C2 H4 Cl2"
static int ELEMENT_TYPE
           
static java.lang.String ELEMENT_WHITESPACE_COUNT
          Example "C 2 H 4 Cl 2"
static int FORMAL_CHARGE
           
static int FORMULA_BUILTIN_COUNT
           
static int FORMULA_FLOATVAL_COUNT
           
static int FORMULA_FLOATVAL_END
           
static int FORMULA_FLOATVAL_START
           
static int FORMULA_INTEGERVAL_COUNT
           
static int FORMULA_INTEGERVAL_END
           
static int FORMULA_INTEGERVAL_START
           
static int FORMULA_STRINGVAL_COUNT
           
static int FORMULA_STRINGVAL_END
           
static int FORMULA_STRINGVAL_START
           
static java.lang.String NESTEDBRACKETS
          Example: "Na2(SO4).10(H2O)"
static java.lang.String NOPUNCTUATION
          Example: "C2H4Cl2"
 
Fields inherited from interface org.xmlcml.cml.AbstractBase
ANGLE, ATOM, ATOMARRAY, ATOMPARITY, BOND, BONDARRAY, BONDSTEREO, BUILTIN, CML, CML_PREFIX, CRYSTAL, ELECTRON, ELEMENT_COUNT, ELEMENT_NAMES, EXECUTE, FEATURE, FLOAT, FLOAT_TYPE, FLOATARRAY, FLOATMATRIX, FORMULA, INTEGER, INTEGER_TYPE, INTEGERARRAY, LINK, LIST, MOLECULE, NAMESPACE_URI, PACKAGE_NAME, REACTION, SEQUENCE, STRING, STRING_TYPE, STRINGARRAY, TORSION, UNK, UNK_ELEM, UNKNOWN
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.xmlcml.cml.AttributeTitle
TITLE
 
Fields inherited from interface org.xmlcml.cml.AttributeDictRef
DICTREF
 
Fields inherited from interface org.xmlcml.cml.AttributeId
ID
 
Fields inherited from interface org.xmlcml.cml.AttributeConvention
CONVENTION
 
Fields inherited from interface org.xmlcml.cml.AbstractBuiltinContainer
NONUNIQUE, STEREO_2D, STEREO_3D, STEREO_ANY, UNIQUE
 
Fields inherited from interface org.xmlcml.cml.AttributeCount
COUNT
 
Method Summary
 void addElement(java.lang.String elementType, double count)
           
 void addFormula(CMLFormula formula)
          Adds a formula to the content.
 void createFromString(java.lang.String formulaString, java.lang.String formulaConvention)
          interpret string as a formula and replace contents.
 void deleteAllFormulas()
          delete all Formulas.
 void deleteFormula(CMLFormula formula)
           
 double getCalculatedMolecularMass()
          NON-DOM convenience
 double[] getElementCounts()
          count for corresponding element; no defaults
 java.lang.String[] getElementTypes()
          Element and count are ganged, so that element[i] corresponds to count[i].
 double getFormalCharge()
          get the charge on this formula moiety; defaults to zero
 java.lang.String getFormattedString(java.lang.String convention, java.lang.String sort, boolean omitCount1)
          /** NON-DOM convenience get formatted formula
 java.util.Vector getFormulaVector()
          CORE Method
extracts ALL the Atoms as a Vector
 void setFormalCharge(double charge)
          set the charge on this formula moiety
 
Methods inherited from interface org.xmlcml.cml.AbstractBase
addTracer, debug, debug, getDisplay, processDOM, readXMLTest, removeTracer, setDOMNeedsProcessing, setDOMNeedsUpdating, updateDOM
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 
Methods inherited from interface org.xmlcml.cml.AttributeTitle
getTitle, processDOMHasTitle, setTitle, updateDOMHasTitle
 
Methods inherited from interface org.xmlcml.cml.AttributeDictRef
getDictRef, processDOMHasDictRef, setDictRef, updateDOMHasDictRef
 
Methods inherited from interface org.xmlcml.cml.AttributeId
getId, processDOMHasId, setId, updateDOMHasId
 
Methods inherited from interface org.xmlcml.cml.AttributeConvention
getConventionName, processDOMHasConvention, setConventionName, updateDOMHasConvention
 
Methods inherited from interface org.xmlcml.cml.AbstractBuiltinContainer
addBuiltinChildWithFloatValue, addBuiltinChildWithIntegerValue, addBuiltinChildWithStringValue, checkBuiltins, deleteNonBuiltinVal, getBuiltinChild, getBuiltinChildElements, getBuiltinChildFloatValue, getBuiltinChildIntegerValue, getBuiltinChildStringValue, getBuiltinCount, getBuiltinVal, getNonBuiltinVal, removeBuiltinChild, setBuiltinFloatChild, setBuiltinIntegerChild, setBuiltinStringChild, setBuiltinVal, setNonBuiltinVal
 
Methods inherited from interface org.xmlcml.cml.AttributeCount
getCount, processDOMHasCount, setCount, updateDOMHasCount
 

Field Detail

FORMULA_FLOATVAL_START

public static final int FORMULA_FLOATVAL_START
See Also:
Constant Field Values

FORMAL_CHARGE

public static final int FORMAL_CHARGE
See Also:
Constant Field Values

FORMULA_FLOATVAL_END

public static final int FORMULA_FLOATVAL_END
See Also:
Constant Field Values

FORMULA_FLOATVAL_COUNT

public static final int FORMULA_FLOATVAL_COUNT
See Also:
Constant Field Values

FORMULA_INTEGERVAL_START

public static final int FORMULA_INTEGERVAL_START
See Also:
Constant Field Values

FORMULA_INTEGERVAL_END

public static final int FORMULA_INTEGERVAL_END
See Also:
Constant Field Values

FORMULA_INTEGERVAL_COUNT

public static final int FORMULA_INTEGERVAL_COUNT
See Also:
Constant Field Values

FORMULA_STRINGVAL_START

public static final int FORMULA_STRINGVAL_START
See Also:
Constant Field Values

ELEMENT_TYPE

public static final int ELEMENT_TYPE
See Also:
Constant Field Values

FORMULA_STRINGVAL_END

public static final int FORMULA_STRINGVAL_END
See Also:
Constant Field Values

FORMULA_STRINGVAL_COUNT

public static final int FORMULA_STRINGVAL_COUNT
See Also:
Constant Field Values

FORMULA_BUILTIN_COUNT

public static final int FORMULA_BUILTIN_COUNT
See Also:
Constant Field Values

builtinFloatValNames

public static final java.lang.String[] builtinFloatValNames

builtinIntegerValNames

public static final java.lang.String[] builtinIntegerValNames

builtinStringValNames

public static final java.lang.String[] builtinStringValNames

NOPUNCTUATION

public static final java.lang.String NOPUNCTUATION
Example: "C2H4Cl2"

See Also:
Constant Field Values

ELEMENT_COUNT_WHITESPACE

public static final java.lang.String ELEMENT_COUNT_WHITESPACE
Example "C2 H4 Cl2"

See Also:
Constant Field Values

ELEMENT_WHITESPACE_COUNT

public static final java.lang.String ELEMENT_WHITESPACE_COUNT
Example "C 2 H 4 Cl 2"

See Also:
Constant Field Values

NESTEDBRACKETS

public static final java.lang.String NESTEDBRACKETS
Example: "Na2(SO4).10(H2O)"

See Also:
Constant Field Values

ANY

public static final java.lang.String ANY
any of the above (input only)

See Also:
Constant Field Values

ALPHABETIC_ELEMENTS

public static final java.lang.String ALPHABETIC_ELEMENTS
sort alphabetically (output only)

See Also:
Constant Field Values

CHFIRST

public static final java.lang.String CHFIRST
C H and then alphabetically (output only)

See Also:
Constant Field Values
Method Detail

createFromString

public void createFromString(java.lang.String formulaString,
                             java.lang.String formulaConvention)
                      throws CMLException
interpret string as a formula and replace contents. (Normal usage would be to create an empty Formula and fill it. If formulaConvention is not ANY then a specific convention is used, for ANY we try a mixture of heuristics. This allows us to throw exceptions if we deviate from conventions. NOTE: all elements are case-sensitive (COCl2 is never CoCl2)


addElement

public void addElement(java.lang.String elementType,
                       double count)

getElementTypes

public java.lang.String[] getElementTypes()
Element and count are ganged, so that element[i] corresponds to count[i].


getElementCounts

public double[] getElementCounts()
count for corresponding element; no defaults


addFormula

public void addFormula(CMLFormula formula)
Adds a formula to the content.


getFormulaVector

public java.util.Vector getFormulaVector()
CORE Method
extracts ALL the Atoms as a Vector


deleteAllFormulas

public void deleteAllFormulas()
delete all Formulas.


deleteFormula

public void deleteFormula(CMLFormula formula)

getFormalCharge

public double getFormalCharge()
get the charge on this formula moiety; defaults to zero


setFormalCharge

public void setFormalCharge(double charge)
set the charge on this formula moiety


getCalculatedMolecularMass

public double getCalculatedMolecularMass()
                                  throws CMLException
NON-DOM convenience


getFormattedString

public java.lang.String getFormattedString(java.lang.String convention,
                                           java.lang.String sort,
                                           boolean omitCount1)
/** NON-DOM convenience get formatted formula