org.xmlcml.cml
Class CMLBaseImpl

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
Direct Known Subclasses:
AbstractAtomRefImpl, AbstractBuiltinContainerImpl, AbstractStringValImpl, CMLImpl, ElectronImpl, ExecuteImpl, FeatureImpl, FormulaImpl, LinkImpl, ListImpl, MoleculeImpl, ReactionImpl, SequenceImpl

public abstract class CMLBaseImpl
extends PMRElementImpl
implements CMLBase

The base class for all elementObjects mentioned in the CML DTD.

Any CML element may have attributes:

and convenience get/set methods are provided for all, through the interfaces HasTitle, HasId and HasConvention.

An element (FOO) subclassed from a CMLBase may be constructed in the following ways:

See Also:
Serialized Form

Field Summary
protected  java.lang.String conventionName
           
protected static java.util.Hashtable conventionTable
           
protected  java.lang.String dictRef
           
protected  java.lang.String id
           
protected  java.lang.String title
           
protected  CMLValidity 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.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
CMLBaseImpl()
          create a Node WITHOUT tagName OR document.
CMLBaseImpl(org.w3c.dom.Element element)
          used when analysing a DOM
CMLBaseImpl(java.lang.String tagName, org.w3c.dom.Document document)
          used when creating new nodes in a DOM
CMLBaseImpl(java.lang.String tagName, org.w3c.dom.Document document, java.lang.String title, java.lang.String id, java.lang.String dictRef, java.lang.String conventionName)
           
 
Method Summary
 void addValidity(CMLValidity v)
          potentially subclassable to determine whether a node is valid.
static PMRElement convertToSubclass(org.w3c.dom.Element element)
          recursively process all nodes.
 void debug(java.io.Writer w)
          output debug info to Writer and return String equivalent (e.g.
 java.lang.String getConventionName()
           
 java.lang.String getDictRef()
           
 java.lang.String getId()
           
static PMRElement getSubClassedElement(java.lang.String name, CMLDocument cmlDocument)
          create a PMRElement (usually a CMLBase) and processDOM() it.
 java.lang.String getTitle()
           
 Validity getValidity()
          Determines whether node is valid (class specific).
static void help()
           
 boolean isValid()
          convenience to avoid analysing Validity
static void main(java.lang.String[] args)
           
 void processDOM()
          subclassed if necessary
 void setConventionName(java.lang.String conventionName)
           
 void setDictRef(java.lang.String dictRef)
           
 void setId(java.lang.String id)
           
 void setTitle(java.lang.String title)
           
static void showElementNames()
           
static void test1(java.lang.String[] args)
           
 void updateDOM()
           
 void updateDOMHasConvention()
           
static void updateDOMHasConvention(HasConvention element)
           
static void updateDOMHasCount(HasCount element)
           
 void updateDOMHasDictRef()
           
static void updateDOMHasDictRef(HasDictRef element)
           
 void updateDOMHasId()
           
static void updateDOMHasId(HasId element)
           
 void updateDOMHasTitle()
           
static void updateDOMHasTitle(HasTitle element)
           
static void updateDOMHasUnits(HasUnits element)
           
 
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, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conventionTable

protected static java.util.Hashtable conventionTable

title

protected java.lang.String title

id

protected java.lang.String id

dictRef

protected java.lang.String dictRef

conventionName

protected java.lang.String conventionName

validity

protected CMLValidity validity
Constructor Detail

CMLBaseImpl

public CMLBaseImpl()
create a Node WITHOUT tagName OR document. Use with care

CMLBaseImpl

public CMLBaseImpl(java.lang.String tagName,
                   org.w3c.dom.Document document)
used when creating new nodes in a DOM

CMLBaseImpl

public CMLBaseImpl(org.w3c.dom.Element element)
used when analysing a DOM

CMLBaseImpl

public CMLBaseImpl(java.lang.String tagName,
                   org.w3c.dom.Document document,
                   java.lang.String title,
                   java.lang.String id,
                   java.lang.String dictRef,
                   java.lang.String conventionName)
Method Detail

showElementNames

public static final void showElementNames()

setTitle

public void setTitle(java.lang.String title)

getTitle

public java.lang.String getTitle()

setId

public void setId(java.lang.String id)

getId

public java.lang.String getId()

setDictRef

public void setDictRef(java.lang.String dictRef)

getDictRef

public java.lang.String getDictRef()

setConventionName

public void setConventionName(java.lang.String conventionName)

getConventionName

public java.lang.String getConventionName()

convertToSubclass

public static PMRElement convertToSubclass(org.w3c.dom.Element element)
                                    throws java.lang.Exception
recursively process all nodes. Assumes we have built a DOM and all Nodes are of type Element. They need to be converted to PMRElement or a subclass of it

getSubClassedElement

public static PMRElement getSubClassedElement(java.lang.String name,
                                              CMLDocument cmlDocument)
                                       throws java.lang.Exception
create a PMRElement (usually a CMLBase) and processDOM() it.

processDOM

public void processDOM()
                throws CMLException
subclassed if necessary
Specified by:
processDOM in interface CMLBase
Overrides:
processDOM in class PMRElementImpl
Tags copied from class: PMRElementImpl
Throws:
java.lang.Exception - these can be of many kinds and may include class-specific ones

addValidity

public void addValidity(CMLValidity v)
potentially subclassable to determine whether a node is valid. Validity objects are merged as they are added. Cleared by adding a null Validity.
Specified by:
addValidity in interface CMLBase
Tags copied from interface: CMLBase
Returns:
boolean truue by default

getValidity

public Validity getValidity()
Description copied from interface: PMRElement
Determines whether node is valid (class specific). Perhaps used in treeWalk mode
Overrides:
getValidity in class PMRElementImpl

isValid

public boolean isValid()
Description copied from interface: CMLBase
convenience to avoid analysing Validity
Specified by:
isValid in interface CMLBase

debug

public void debug(java.io.Writer w)
           throws java.io.IOException
output debug info to Writer and return String equivalent (e.g. with new StringWriter()
Specified by:
debug in interface CMLBase
Parameters:
Writer - w Writer to output to
Returns:
the String equivalent

help

public static void help()

updateDOMHasConvention

public static void updateDOMHasConvention(HasConvention element)

updateDOMHasDictRef

public static void updateDOMHasDictRef(HasDictRef element)

updateDOMHasCount

public static void updateDOMHasCount(HasCount element)

updateDOMHasId

public static void updateDOMHasId(HasId element)

updateDOMHasTitle

public static void updateDOMHasTitle(HasTitle element)

updateDOMHasUnits

public static void updateDOMHasUnits(HasUnits element)

updateDOMHasConvention

public void updateDOMHasConvention()

updateDOMHasDictRef

public void updateDOMHasDictRef()

updateDOMHasId

public void updateDOMHasId()

updateDOMHasTitle

public void updateDOMHasTitle()

updateDOM

public void updateDOM()
               throws CMLException
Specified by:
updateDOM in interface CMLBase

test1

public static void test1(java.lang.String[] args)
                  throws java.lang.Exception

main

public static void main(java.lang.String[] args)