Package edu.msu.cme.rdp.classifier.io
Class TreeFileParser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- edu.msu.cme.rdp.classifier.io.TreeFileParser
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class TreeFileParser extends org.xml.sax.helpers.DefaultHandler
A parser to parse a reader containing taxonomic training information. Note: The first TreeNode is the root TreeNode.
-
-
Constructor Summary
Constructors Constructor Description TreeFileParser()
Creates a new instance of TreeFileParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HierarchyTree
createTree(java.io.Reader in, HierarchyVersion version)
Reads from a reader that contains the information for each treenode.void
endElement(java.lang.String str, java.lang.String str1, java.lang.String str2)
void
error(org.xml.sax.SAXParseException e)
java.lang.String
getTrainRank()
void
startElement(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
-
-
-
Method Detail
-
getTrainRank
public java.lang.String getTrainRank()
-
createTree
public HierarchyTree createTree(java.io.Reader in, HierarchyVersion version) throws java.io.IOException, TrainingDataException
Reads from a reader that contains the information for each treenode. Creates all the HierarchyTrees and returns the root of the trees. Note: The first TreeNode is the root TreeNode. The version information should be obtained from the other files first.- Throws:
java.io.IOException
TrainingDataException
-
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 interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String str, java.lang.String str1, java.lang.String str2) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
error
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
-