cct.tools
Class CCTParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by cct.tools.CCTParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class CCTParser
extends org.xml.sax.helpers.DefaultHandler

Title:

Description:

Copyright: Copyright (c) 2006

Company: ANU


Field Summary
(package private)  java.util.ArrayList atoms
           
(package private)  java.util.ArrayList bonds
           
(package private)  MoleculeInterface currentMolecule
           
(package private)  java.lang.String currentTag
           
(package private) static boolean Debug
           
(package private)  boolean finish_parsing
           
(package private)  java.lang.String fullString
           
(package private) static java.lang.String INTERNAL_PROPERTY
           
(package private)  java.util.ArrayList molecules
           
(package private)  int parseLevel
           
(package private)  java.util.ResourceBundle resources
           
(package private)  java.io.StringReader sReader
           
(package private)  java.io.StringWriter sWriter
           
(package private)  boolean unrecoverableError
           
(package private)  boolean yes_cct
           
(package private)  boolean yes_many_atoms
           
(package private)  boolean yes_many_molecules
           
(package private)  boolean yes_many_monomers
           
(package private)  boolean yes_molecule
           
 
Constructor Summary
CCTParser(MoleculeInterface molecule)
           
 
Method Summary
 void characters(char[] buf, int offset, int len)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
           
 java.util.ArrayList getMolecules()
           
 int getMoleculesCount()
           
static java.lang.String getObjectAsString(java.lang.Object data)
           
static java.lang.Object getObjectClass(java.lang.String data, java.lang.String dataClass)
           
static java.util.ArrayList parseCCTFile(java.lang.Object inputSource, MoleculeInterface molecule)
           
static java.util.ArrayList readAtoms(java.lang.String bondsAsString, MoleculeInterface molec)
           
static java.util.ArrayList readBonds(java.lang.String bondsAsString, MoleculeInterface molec)
           
static java.util.ArrayList readMonomers(java.lang.String monomersAsString, MoleculeInterface molec)
          Reads list of monomers
static java.util.ArrayList readProperty(java.lang.String propertyAsString, java.lang.String ID, java.lang.String Type, java.lang.String Format, java.lang.String Class, MoleculeInterface molec)
           
static void saveCCTFile(java.util.ArrayList mols, java.lang.String fileName)
           
static void saveCCTFile(MoleculeInterface molec, java.lang.String fileName)
           
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
           
static void writeAtoms(javax.xml.transform.sax.TransformerHandler hd, MoleculeInterface molec)
           
static void writeBonds(javax.xml.transform.sax.TransformerHandler hd, MoleculeInterface molec)
           
static void writeProperties(javax.xml.transform.sax.TransformerHandler hd, MoleculeInterface molec)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Debug

static boolean Debug

INTERNAL_PROPERTY

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

molecules

java.util.ArrayList molecules

atoms

java.util.ArrayList atoms

bonds

java.util.ArrayList bonds

finish_parsing

boolean finish_parsing

yes_cct

boolean yes_cct

yes_many_molecules

boolean yes_many_molecules

yes_many_monomers

boolean yes_many_monomers

yes_many_atoms

boolean yes_many_atoms

yes_molecule

boolean yes_molecule

unrecoverableError

boolean unrecoverableError

parseLevel

int parseLevel

currentTag

java.lang.String currentTag

fullString

java.lang.String fullString

currentMolecule

MoleculeInterface currentMolecule

sReader

java.io.StringReader sReader

sWriter

java.io.StringWriter sWriter

resources

java.util.ResourceBundle resources
Constructor Detail

CCTParser

public CCTParser(MoleculeInterface molecule)
Method Detail

parseCCTFile

public static java.util.ArrayList parseCCTFile(java.lang.Object inputSource,
                                               MoleculeInterface molecule)
Parameters:
file_name - String
molecule - MoleculeInterface
Returns:
ArrayList

saveCCTFile

public static void saveCCTFile(MoleculeInterface molec,
                               java.lang.String fileName)
                        throws java.lang.Exception
Throws:
java.lang.Exception

saveCCTFile

public static void saveCCTFile(java.util.ArrayList mols,
                               java.lang.String fileName)
                        throws java.lang.Exception
Throws:
java.lang.Exception

writeBonds

public static void writeBonds(javax.xml.transform.sax.TransformerHandler hd,
                              MoleculeInterface molec)
                       throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

writeAtoms

public static void writeAtoms(javax.xml.transform.sax.TransformerHandler hd,
                              MoleculeInterface molec)
                       throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

writeProperties

public static void writeProperties(javax.xml.transform.sax.TransformerHandler hd,
                                   MoleculeInterface molec)
                            throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getMoleculesCount

public int getMoleculesCount()

getMolecules

public java.util.ArrayList getMolecules()

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String lName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String sName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] buf,
                       int offset,
                       int len)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

readBonds

public static java.util.ArrayList readBonds(java.lang.String bondsAsString,
                                            MoleculeInterface molec)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

readProperty

public static java.util.ArrayList readProperty(java.lang.String propertyAsString,
                                               java.lang.String ID,
                                               java.lang.String Type,
                                               java.lang.String Format,
                                               java.lang.String Class,
                                               MoleculeInterface molec)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getObjectAsString

public static java.lang.String getObjectAsString(java.lang.Object data)

getObjectClass

public static java.lang.Object getObjectClass(java.lang.String data,
                                              java.lang.String dataClass)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

readAtoms

public static java.util.ArrayList readAtoms(java.lang.String bondsAsString,
                                            MoleculeInterface molec)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

readMonomers

public static java.util.ArrayList readMonomers(java.lang.String monomersAsString,
                                               MoleculeInterface molec)
                                        throws java.lang.Exception
Reads list of monomers

Parameters:
monomersAsString - String
molec - MoleculeInterface
Returns:
ArrayList
Throws:
java.lang.Exception