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

Quick Search    Search Deep

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

java.lang.Object
  extended byPMRDocumentImpl
      extended byorg.xmlcml.cmlimpl.CMLDocumentImpl
          extended byorg.xmlcml.noncml.NonCMLDocumentImpl
              extended byorg.xmlcml.noncml.SMILESImpl
All Implemented Interfaces:
org.xmlcml.cml.CMLDocument, org.w3c.dom.Document, org.xmlcml.cml.mvc.HasController, org.w3c.dom.Node, NonCMLDocument, SMILES

public class SMILESImpl
extends NonCMLDocumentImpl
implements SMILES

class to read and write SMILES files


Field Summary
(package private)  java.util.Hashtable aromaticTable
           
protected  java.util.Vector linkVector
           
(package private)  java.lang.String order
           
(package private)  java.util.Hashtable serialTable
           
protected  java.lang.String smilesString
           
(package private)  org.xmlcml.cml.subset.SpanningTree spanningTree
           
 
Fields inherited from class org.xmlcml.noncml.NonCMLDocumentImpl
ATOM_FACTORY, atomParent, atomVector, BOND_FACTORY, bondParent, bondVector, bReader, convention, currentLine, DOCUMENT_FACTORY, inputCML, inputCMLMolecule, inputDescription2TypeTable, localDictionary, markLine, MOLECULE_FACTORY, natoms, nbonds, nextLine, nLine, nonCmlDoc, outputCML, outputCMLMolecule, outputDescription2TypeTable, parseFile, selector, SPACE40, SPACE80
 
Fields inherited from class org.xmlcml.cmlimpl.CMLDocumentImpl
CML_DICTIONARY, controller, moleculeVector
 
Fields inherited from interface org.xmlcml.noncml.SMILES
LINKVECTORSIZE, SIMPLE_ELEMENTS
 
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
SMILESImpl()
           
SMILESImpl(java.io.BufferedReader bReader, java.lang.String id)
          form a SMILES object from a local file
SMILESImpl(org.xmlcml.cml.CMLMolecule outputCMLMolecule)
          form a SMILES object from a CML file
 
Method Summary
(package private)  void addBondToParent(org.xmlcml.cml.CMLAtom atom, org.xmlcml.cml.subset.STElement newatomElement)
           
(package private)  void addLink(org.xmlcml.cml.CMLAtom atom)
          adds link to smilesString if appropriate
(package private)  int builtinElementLength(java.lang.String s)
          length of builtin SMILES Chemical element? Case-sensitive no match returns 0
static java.lang.String cmlBondOrder(java.lang.String smilesBond)
          translates SMILES bond orders into JUMBO-MOL orders
(package private)  org.xmlcml.cml.CMLAtom createAtomFromSMILESAtom(SMILESAtom sa)
          create a new atom from s.
(package private)  org.xmlcml.cml.CMLAtom createAtomFromString(java.lang.String s)
           
static org.xmlcml.cml.CMLMolecule createMolecule(java.lang.String s)
           
static SMILES createSMILESFromString(java.lang.String s)
           
(package private)  void interpretString(org.xmlcml.cml.subset.STElement parentElement, java.lang.String s)
          interprets a SMILES string
(package private)  boolean is2LetterElement(java.lang.String s)
          is an element a valid SMILES Chemical element?
static void main(java.lang.String[] args)
           
 java.lang.String output(java.io.Writer writer)
          outputs CMLMolecule as a SMILES
 void parse(java.io.BufferedReader bReader)
          input from a Reader.
 void parse(java.lang.String line)
          input from the Smiles String
(package private)  void processLink(org.xmlcml.cml.subset.STElement node2, char number)
          process numeric link in SMILES
(package private)  void processSmilesString()
           
(package private)  void processSpanningTree(org.xmlcml.cml.subset.STElement stElement)
           
(package private)  void removeElements(java.util.Vector theVector, java.util.Vector removeVector)
           
(package private)  void resetLinkVector()
          set linkVector to have (10) preset elements, initially null
static java.lang.String SMILESBondOrder(java.lang.String cmlCode)
          translates "CML" codes into SMILES symbols
 java.lang.String writeAtoms(java.io.Writer writer)
           
 java.lang.String writeBonds(java.io.Writer writer)
           
 java.lang.String writeFooter(java.io.Writer writer)
           
 
Methods inherited from class org.xmlcml.noncml.NonCMLDocumentImpl
addDataItem, convertFile, convertList, createAndAddCMLElement, createAndAddMoleculeElement, createCMLDocument, createCMLDocument, createCMLDocument, createCMLElement, createMoleculeElement, getAndCheckVectors, getCurrentLine, getDictionary, getInputDescriptions, getInputSuffixes, getInputTypes, getMoleculeVector, getOutputDescriptions, getOutputSuffixes, getOutputTypes, getSelector, getSuffixFromType, getTypeFromFile, getTypesFromFile, makeDataItem, makeFileStem, outform, parse, peekLine, processLinks, readFortranReal, readNextLine, resetMark, setMark, setOutputCML, setOutputCMLMolecule, setParseFile, setSelector
 
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.noncml.NonCMLDocument
createAndAddMoleculeElement, createMoleculeElement, setOutputCML, setOutputCMLMolecule
 
Methods inherited from interface org.xmlcml.cml.CMLDocument
arrayify, deArrayify, debug, debug, dereferenceLinks, getMolecule, getMoleculeFactory, getMoleculeList, getMoleculeVector, hasLinkElements, parse, 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

serialTable

java.util.Hashtable serialTable

linkVector

protected java.util.Vector linkVector

smilesString

protected java.lang.String smilesString

order

java.lang.String order

spanningTree

org.xmlcml.cml.subset.SpanningTree spanningTree

aromaticTable

java.util.Hashtable aromaticTable
Constructor Detail

SMILESImpl

public SMILESImpl()

SMILESImpl

public SMILESImpl(java.io.BufferedReader bReader,
                  java.lang.String id)
           throws java.lang.Exception
form a SMILES object from a local file


SMILESImpl

public SMILESImpl(org.xmlcml.cml.CMLMolecule outputCMLMolecule)
form a SMILES object from a CML file

Method Detail

parse

public void parse(java.io.BufferedReader bReader)
           throws java.io.IOException,
                  org.xmlcml.cml.CMLException
Description copied from interface: NonCMLDocument
input from a Reader. If the String value is to be input, use a StringReader. This could be used after a default constructor either immediately or with some additional customisation and may be used in the class constructors. Note that parse(URL) is inherited from CMLDocument

Specified by:
parse in interface NonCMLDocument
Specified by:
parse in class NonCMLDocumentImpl

parse

public void parse(java.lang.String line)
           throws org.xmlcml.cml.CMLException
input from the Smiles String

Specified by:
parse in interface SMILES

createSMILESFromString

public static SMILES createSMILESFromString(java.lang.String s)
                                     throws org.xmlcml.cml.CMLException

createMolecule

public static org.xmlcml.cml.CMLMolecule createMolecule(java.lang.String s)
                                                 throws org.xmlcml.cml.CMLException

interpretString

void interpretString(org.xmlcml.cml.subset.STElement parentElement,
                     java.lang.String s)
               throws org.xmlcml.cml.CMLException
interprets a SMILES string


createAtomFromSMILESAtom

org.xmlcml.cml.CMLAtom createAtomFromSMILESAtom(SMILESAtom sa)
                                          throws org.xmlcml.cml.CMLException
create a new atom from s. The Node is filled with the new details


createAtomFromString

org.xmlcml.cml.CMLAtom createAtomFromString(java.lang.String s)
                                      throws org.xmlcml.cml.CMLException

addBondToParent

void addBondToParent(org.xmlcml.cml.CMLAtom atom,
                     org.xmlcml.cml.subset.STElement newatomElement)
               throws org.xmlcml.cml.CMLException

processLink

void processLink(org.xmlcml.cml.subset.STElement node2,
                 char number)
           throws org.xmlcml.cml.CMLException
process numeric link in SMILES


resetLinkVector

void resetLinkVector()
set linkVector to have (10) preset elements, initially null


builtinElementLength

int builtinElementLength(java.lang.String s)
length of builtin SMILES Chemical element? Case-sensitive no match returns 0


is2LetterElement

boolean is2LetterElement(java.lang.String s)
is an element a valid SMILES Chemical element?


processSmilesString

void processSmilesString()

processSpanningTree

void processSpanningTree(org.xmlcml.cml.subset.STElement stElement)
                   throws org.xmlcml.cml.CMLException

addLink

void addLink(org.xmlcml.cml.CMLAtom atom)
adds link to smilesString if appropriate


removeElements

void removeElements(java.util.Vector theVector,
                    java.util.Vector removeVector)

SMILESBondOrder

public static java.lang.String SMILESBondOrder(java.lang.String cmlCode)
translates "CML" codes into SMILES symbols


cmlBondOrder

public static java.lang.String cmlBondOrder(java.lang.String smilesBond)
translates SMILES bond orders into JUMBO-MOL orders


output

public java.lang.String output(java.io.Writer writer)
                        throws org.xmlcml.cml.CMLException,
                               java.io.IOException
outputs CMLMolecule as a SMILES

Specified by:
output in interface NonCMLDocument
Specified by:
output in class NonCMLDocumentImpl

writeAtoms

public java.lang.String writeAtoms(java.io.Writer writer)
                            throws org.xmlcml.cml.CMLException,
                                   java.io.IOException

writeBonds

public java.lang.String writeBonds(java.io.Writer writer)
                            throws org.xmlcml.cml.CMLException,
                                   java.io.IOException

writeFooter

public java.lang.String writeFooter(java.io.Writer writer)
                             throws org.xmlcml.cml.CMLException,
                                    java.io.IOException

main

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