- 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.
| 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 |
| 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.AbstractBuiltinContainer |
addBuiltinChildWithFloatValue, addBuiltinChildWithIntegerValue, addBuiltinChildWithStringValue, checkBuiltins, deleteNonBuiltinVal, getBuiltinChild, getBuiltinChildElements, getBuiltinChildFloatValue, getBuiltinChildIntegerValue, getBuiltinChildStringValue, getBuiltinCount, getBuiltinVal, getNonBuiltinVal, removeBuiltinChild, setBuiltinFloatChild, setBuiltinIntegerChild, setBuiltinStringChild, setBuiltinVal, setNonBuiltinVal |
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
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