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

Quick Search    Search Deep

org.xmlcml.noncml
Class NonCMLDocumentImpl  view NonCMLDocumentImpl download NonCMLDocumentImpl.java

java.lang.Object
  extended byPMRDocumentImpl
      extended byorg.xmlcml.cmlimpl.CMLDocumentImpl
          extended byorg.xmlcml.noncml.NonCMLDocumentImpl
All Implemented Interfaces:
org.xmlcml.cml.CMLDocument, org.w3c.dom.Document, org.xmlcml.cml.mvc.HasController, org.w3c.dom.Node, NonCMLDocument
Direct Known Subclasses:
CASTEPImpl, CIFImpl, DummyImpl, FormatImpl, G94Impl, GAMESSImpl, JCAMPImpl, JMEImpl, MDLMolImpl, MOL2Impl, MOPACImpl, MOPACInImpl, PDBConectImpl, PDBImpl, PreStyleImpl, SDFImpl, SMILESImpl, VAMPImpl, XYZImpl

public abstract class NonCMLDocumentImpl
extends org.xmlcml.cmlimpl.CMLDocumentImpl
implements NonCMLDocument

base class for all nonCML molecules


Field Summary
static org.xmlcml.cml.CMLAtomFactory ATOM_FACTORY
          creates Atoms of the appropriate subclass
protected  org.xmlcml.cml.AbstractBase atomParent
           
protected  java.util.Vector atomVector
          general tools for input and output
static org.xmlcml.cml.CMLBondFactory BOND_FACTORY
          creates Bonds of the appropriate subclass
protected  org.xmlcml.cml.AbstractBase bondParent
           
protected  java.util.Vector bondVector
           
protected  java.io.BufferedReader bReader
          most input requires a BufferedReader
protected  java.lang.String convention
           
protected  java.lang.String currentLine
          and uses a line as the container
static org.xmlcml.cml.CMLDocumentFactory DOCUMENT_FACTORY
          creates Documents of the appropriate subclass
protected  org.xmlcml.cml.CML inputCML
          the CML object created from the input legacy
protected  org.xmlcml.cml.CMLMolecule inputCMLMolecule
          the molecule created from the input legacy
static java.util.Hashtable inputDescription2TypeTable
           
protected static org.xmlcml.cml.metadata.CMLDictionary localDictionary
           
(package private)  int markLine
           
static org.xmlcml.cml.CMLMoleculeFactory MOLECULE_FACTORY
          creates Molecules of the appropriate subclass
protected  int natoms
           
protected  int nbonds
           
(package private)  java.lang.String nextLine
           
protected  int nLine
           
protected  org.xmlcml.cml.CMLDocument nonCmlDoc
          result of a parse
protected  org.xmlcml.cml.CML outputCML
          a CML object to be output as legacy
protected  org.xmlcml.cml.CMLMolecule outputCMLMolecule
          a CML CMLMolecule to be output as legacy
static java.util.Hashtable outputDescription2TypeTable
           
(package private) static java.lang.String parseFile
          the current parse script (messy) - not thread-safe! Set this immediately before oarsing legacy file.
protected  Selector selector
           
static java.lang.String SPACE40
          crude hacks for traling blanks in fortran
static java.lang.String SPACE80
           
 
Fields inherited from class org.xmlcml.cmlimpl.CMLDocumentImpl
CML_DICTIONARY, controller, moleculeVector
 
Fields inherited from interface org.xmlcml.noncml.NonCMLDocument
CASTEP, CIF, CML, CMLARRAY, FORMAT, G94, GAMESS, INPUT_DESCRIPTIONS, INPUT_SUFFIXES, INPUT_TYPES, JCAMP, JME, MDLMOL, MIF, MMCIF, MOL2, MOPAC, MOPACIn, OUTPUT_DESCRIPTIONS, OUTPUT_SUFFIXES, OUTPUT_TYPES, PDB, PDBConect, SDF, SMILES, SWISS, TEST, VAMP, XML, XYZ
 
Fields inherited from interface org.xmlcml.cml.CMLDocument
CML_DICTIONARY_FILENAME, CML_DICTIONARY_NAME, CML_DICTIONARY_NAMESPACE_URI, CML_DICTIONARY_PREFIX, PACKAGE_NAME
 
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
 
Constructor Summary
protected NonCMLDocumentImpl()
           
 
Method Summary
 void addDataItem(org.w3c.dom.Element parent, java.lang.String id, java.lang.Object obj)
          creates an object of type determined by a dictionary id
static void convertFile(java.lang.String inFile, java.lang.String inType, java.io.FileWriter fw, java.lang.String outType)
           
static void convertList(java.lang.String inList, java.lang.String inType, java.lang.String outDir, java.lang.String outFile, java.lang.String outType)
           
protected  void createAndAddCMLElement(java.lang.String convention, java.lang.String id)
           
 void createAndAddMoleculeElement(java.lang.String convention, java.lang.String id)
          create molecule (inputCMLMolecule) *and add as document Element*
static org.xmlcml.cml.CMLDocument createCMLDocument(java.lang.String type)
          create from file and subclass using SAX; the default CMLDOMSAXBuilder determines the subclassing
static org.xmlcml.cml.CMLDocument createCMLDocument(java.net.URL url)
          Convenience method - uses defaults to create a CMLDocument from the input URL.
static org.xmlcml.cml.CMLDocument createCMLDocument(java.net.URL urlx, java.lang.String type)
          Convenience method - uses defaults to create a CMLDocument from the input URL.
protected  void createCMLElement(java.lang.String convention, java.lang.String id)
           
 void createMoleculeElement(java.lang.String convention, java.lang.String id)
          Create a molecule of given convention and id; convention is e.g.
protected  void getAndCheckVectors()
           
(package private)  java.lang.String getCurrentLine()
           
static org.xmlcml.cml.metadata.CMLDictionary getDictionary(org.xmlcml.cmlimpl.CMLDocumentImpl doc)
           
static java.lang.String[] getInputDescriptions()
          get allowed file suffixes
static java.lang.String[][] getInputSuffixes()
          get allowed file suffixes
static java.lang.String[] getInputTypes()
          get allowed file types
static java.util.Vector getMoleculeVector(java.lang.String inputFile, java.lang.String type)
          creates a nonCMLDocument from the input URL.
static java.lang.String[] getOutputDescriptions()
          get allowed file suffixes
static java.lang.String[] getOutputSuffixes()
          get allowed file suffixes
static java.lang.String[] getOutputTypes()
          get allowed file types
 Selector getSelector()
           
static java.lang.String getSuffixFromType(java.lang.String type)
          hardcoded suffixes - probably will be phased out in favout of getTypesFromFile
static java.lang.String getTypeFromFile(java.lang.String fileName)
          hardcoded types - probably will be phased out in favout of getTypesFromFile
static java.lang.String[] getTypesFromFile(java.lang.String fileName)
          gives all possible types which have the suffix on fileName.
static void main(java.lang.String[] args)
           
 org.xmlcml.cml.AbstractBase makeDataItem(org.xmlcml.cml.metadata.CMLDictionaryEntry entry, java.lang.String value)
          creates an object of type determined by a dictionary entry
(package private) static java.lang.String makeFileStem(java.lang.String file)
           
static java.lang.String outform(double v, int f, int d)
           
abstract  java.lang.String output(java.io.Writer w)
          The main output routine.
abstract  void parse(java.io.BufferedReader reader)
          The main parsing routine.
 void parse(java.net.URL url)
          convenience method - routes to bufferedReader
(package private)  java.lang.String peekLine()
           
static void processLinks(org.xmlcml.cml.CMLDocument cmlDoc)
           
static double readFortranReal(java.lang.String f)
           
(package private)  java.lang.String readNextLine()
           
(package private)  void resetMark()
           
(package private)  void setMark()
           
 void setOutputCML(org.xmlcml.cml.CML outputCML)
          to output a CML in legacy form - still under development
 void setOutputCMLMolecule(org.xmlcml.cml.CMLMolecule outputCMLMolecule)
          to output a CML-CMLMolecule in legacy form the molecule must be added to the NonCMLDocument and then the output() method called
static void setParseFile(java.lang.String f)
          set the parse file - use null to reset it
 void setSelector(Selector selector)
           
 
Methods inherited from class org.xmlcml.cmlimpl.CMLDocumentImpl
addTracer, arrayify, createCMLDocument, deArrayify, debug, debug, dereferenceDescendantLinks, dereferenceLinks, getController, getDictionaryFileName, getDictionaryName, getDictionaryNamespaceURI, getDictionaryPrefix, getMolecule, getMoleculeFactory, getMoleculeList, getMoleculeVector, hasLinkElements, isTrace, readXMLTest, removeTracer, setController, setMoleculeFactory, setTrace, test1, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmlcml.cml.CMLDocument
arrayify, deArrayify, debug, debug, dereferenceLinks, getMolecule, getMoleculeFactory, getMoleculeList, getMoleculeVector, hasLinkElements, readXMLTest, setMoleculeFactory
 
Methods inherited from interface org.w3c.dom.Document
adoptNode, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion
 
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
 

Field Detail

SPACE40

public static final java.lang.String SPACE40
crude hacks for traling blanks in fortran

See Also:
Constant Field Values

SPACE80

public static final java.lang.String SPACE80
See Also:
Constant Field Values

localDictionary

protected static org.xmlcml.cml.metadata.CMLDictionary localDictionary

ATOM_FACTORY

public static final org.xmlcml.cml.CMLAtomFactory ATOM_FACTORY
creates Atoms of the appropriate subclass


BOND_FACTORY

public static final org.xmlcml.cml.CMLBondFactory BOND_FACTORY
creates Bonds of the appropriate subclass


DOCUMENT_FACTORY

public static final org.xmlcml.cml.CMLDocumentFactory DOCUMENT_FACTORY
creates Documents of the appropriate subclass


MOLECULE_FACTORY

public static final org.xmlcml.cml.CMLMoleculeFactory MOLECULE_FACTORY
creates Molecules of the appropriate subclass


parseFile

static java.lang.String parseFile
the current parse script (messy) - not thread-safe! Set this immediately before oarsing legacy file. Set to null to disable script-based parsing


inputCML

protected org.xmlcml.cml.CML inputCML
the CML object created from the input legacy


outputCML

protected org.xmlcml.cml.CML outputCML
a CML object to be output as legacy


inputCMLMolecule

protected org.xmlcml.cml.CMLMolecule inputCMLMolecule
the molecule created from the input legacy


outputCMLMolecule

protected org.xmlcml.cml.CMLMolecule outputCMLMolecule
a CML CMLMolecule to be output as legacy


nonCmlDoc

protected org.xmlcml.cml.CMLDocument nonCmlDoc
result of a parse


bReader

protected java.io.BufferedReader bReader
most input requires a BufferedReader


currentLine

protected java.lang.String currentLine
and uses a line as the container


nLine

protected int nLine

atomVector

protected java.util.Vector atomVector
general tools for input and output


bondVector

protected java.util.Vector bondVector

natoms

protected int natoms

nbonds

protected int nbonds

selector

protected Selector selector

atomParent

protected org.xmlcml.cml.AbstractBase atomParent

bondParent

protected org.xmlcml.cml.AbstractBase bondParent

convention

protected java.lang.String convention

inputDescription2TypeTable

public static java.util.Hashtable inputDescription2TypeTable

outputDescription2TypeTable

public static java.util.Hashtable outputDescription2TypeTable

nextLine

java.lang.String nextLine

markLine

int markLine
Constructor Detail

NonCMLDocumentImpl

protected NonCMLDocumentImpl()
Method Detail

parse

public abstract void parse(java.io.BufferedReader reader)
                    throws java.lang.Exception
The main parsing routine. must be overridden

Specified by:
parse in interface NonCMLDocument

output

public abstract java.lang.String output(java.io.Writer w)
                                 throws java.io.IOException,
                                        org.xmlcml.cml.CMLException
The main output routine. Must be overridden

Specified by:
output in interface NonCMLDocument

setOutputCMLMolecule

public void setOutputCMLMolecule(org.xmlcml.cml.CMLMolecule outputCMLMolecule)
Description copied from interface: NonCMLDocument
to output a CML-CMLMolecule in legacy form the molecule must be added to the NonCMLDocument and then the output() method called

Specified by:
setOutputCMLMolecule in interface NonCMLDocument

setOutputCML

public void setOutputCML(org.xmlcml.cml.CML outputCML)
Description copied from interface: NonCMLDocument
to output a CML in legacy form - still under development

Specified by:
setOutputCML in interface NonCMLDocument

getAndCheckVectors

protected void getAndCheckVectors()
                           throws org.xmlcml.cml.CMLException

createAndAddMoleculeElement

public void createAndAddMoleculeElement(java.lang.String convention,
                                        java.lang.String id)
create molecule (inputCMLMolecule) *and add as document Element*

Specified by:
createAndAddMoleculeElement in interface NonCMLDocument

createMoleculeElement

public void createMoleculeElement(java.lang.String convention,
                                  java.lang.String id)
Description copied from interface: NonCMLDocument
Create a molecule of given convention and id; convention is e.g. XYZ

Specified by:
createMoleculeElement in interface NonCMLDocument

createCMLElement

protected void createCMLElement(java.lang.String convention,
                                java.lang.String id)

createAndAddCMLElement

protected void createAndAddCMLElement(java.lang.String convention,
                                      java.lang.String id)

getMoleculeVector

public static java.util.Vector getMoleculeVector(java.lang.String inputFile,
                                                 java.lang.String type)
                                          throws java.lang.Exception
creates a nonCMLDocument from the input URL. Many formats only return one molecule but some (e.g. SDF) may return many Perhaps obsolete


parse

public void parse(java.net.URL url)
           throws java.lang.Exception
convenience method - routes to bufferedReader

Specified by:
parse in interface org.xmlcml.cml.CMLDocument

getInputTypes

public static java.lang.String[] getInputTypes()
get allowed file types


getInputSuffixes

public static java.lang.String[][] getInputSuffixes()
get allowed file suffixes


getInputDescriptions

public static java.lang.String[] getInputDescriptions()
get allowed file suffixes


getOutputTypes

public static java.lang.String[] getOutputTypes()
get allowed file types


getOutputSuffixes

public static java.lang.String[] getOutputSuffixes()
get allowed file suffixes


getOutputDescriptions

public static java.lang.String[] getOutputDescriptions()
get allowed file suffixes


createCMLDocument

public static org.xmlcml.cml.CMLDocument createCMLDocument(java.lang.String type)
                                                    throws org.xmlcml.cml.CMLException
Description copied from class: org.xmlcml.cmlimpl.CMLDocumentImpl
create from file and subclass using SAX; the default CMLDOMSAXBuilder determines the subclassing


makeFileStem

static java.lang.String makeFileStem(java.lang.String file)

processLinks

public static void processLinks(org.xmlcml.cml.CMLDocument cmlDoc)
                         throws java.lang.Exception

setParseFile

public static void setParseFile(java.lang.String f)
set the parse file - use null to reset it


createCMLDocument

public static org.xmlcml.cml.CMLDocument createCMLDocument(java.net.URL urlx,
                                                           java.lang.String type)
                                                    throws java.lang.Exception
Convenience method - uses defaults to create a CMLDocument from the input URL. Very variable returns according to type. Many formats only return one molecule but some (e.g. SDF) may return many


getTypesFromFile

public static final java.lang.String[] getTypesFromFile(java.lang.String fileName)
gives all possible types which have the suffix on fileName. Thus "foo.mol" could return MDLMol and MOL2


getTypeFromFile

public static final java.lang.String getTypeFromFile(java.lang.String fileName)
hardcoded types - probably will be phased out in favout of getTypesFromFile


getSuffixFromType

public static final java.lang.String getSuffixFromType(java.lang.String type)
hardcoded suffixes - probably will be phased out in favout of getTypesFromFile


convertList

public static void convertList(java.lang.String inList,
                               java.lang.String inType,
                               java.lang.String outDir,
                               java.lang.String outFile,
                               java.lang.String outType)
                        throws java.lang.Exception

convertFile

public static void convertFile(java.lang.String inFile,
                               java.lang.String inType,
                               java.io.FileWriter fw,
                               java.lang.String outType)
                        throws java.lang.Exception

createCMLDocument

public static org.xmlcml.cml.CMLDocument createCMLDocument(java.net.URL url)
                                                    throws java.lang.Exception
Convenience method - uses defaults to create a CMLDocument from the input URL. and its suffix. Very variable returns according to type. Many formats only return one molecule but some (e.g. SDF) may return many


makeDataItem

public org.xmlcml.cml.AbstractBase makeDataItem(org.xmlcml.cml.metadata.CMLDictionaryEntry entry,
                                                java.lang.String value)
                                         throws org.xmlcml.cml.CMLException
creates an object of type determined by a dictionary entry


addDataItem

public void addDataItem(org.w3c.dom.Element parent,
                        java.lang.String id,
                        java.lang.Object obj)
                 throws org.xmlcml.cml.CMLException
creates an object of type determined by a dictionary id


getDictionary

public static org.xmlcml.cml.metadata.CMLDictionary getDictionary(org.xmlcml.cmlimpl.CMLDocumentImpl doc)

setSelector

public void setSelector(Selector selector)

getSelector

public Selector getSelector()

getCurrentLine

java.lang.String getCurrentLine()
                          throws java.io.IOException

peekLine

java.lang.String peekLine()
                    throws java.io.IOException

readNextLine

java.lang.String readNextLine()
                        throws java.io.IOException

setMark

void setMark()
       throws java.io.IOException

resetMark

void resetMark()
         throws java.io.IOException

outform

public static java.lang.String outform(double v,
                                       int f,
                                       int d)

readFortranReal

public static double readFortranReal(java.lang.String f)
                              throws java.lang.NumberFormatException

main

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