|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectphylonet.tree.io.NewickReader
public class NewickReader
This class reads trees in newick format from a stream provided as a Reader
. The tree read is loaded
into a Tree object provided.
The exact format supported is as follows:
[TREENAME =] [ROOTING] NEWICKSTRING[;]All components in square braces are optional. TREENAME can be any legitimate string of characters. ROOTING is "[&U]" for unrooted trees and "[&R]" for rooted trees. The semicolon is optionally used to indicate the end of the tree.
Because of the way that this reader tokenizes, you cannot use a reader to read a tree and then use the same reader to read other parts of a larger input stream. Rather, it is necessary for you to read the tree containing section out of the larger input stream and feed this string/stream to the tree by itself. If you don't do this, the tokenizer inside the NewickReader will potentially tokenize characters past the end of the trees.
Constructor Summary | |
---|---|
NewickReader(java.io.Reader r)
|
Method Summary | |
---|---|
boolean |
isNextRooted()
|
boolean |
reachedEOF()
Indicates whether the end of the reader has been reached. |
MutableTree |
readTree()
This method reads in a tree and returns the tree read in. |
void |
readTree(MutableTree tree)
This method reads a tree from the reader. |
void |
readTree(STITree<java.lang.Double> tree)
This method reads a tree from the reader. |
java.lang.String |
readTreeName()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NewickReader(java.io.Reader r)
Method Detail |
---|
public MutableTree readTree() throws java.io.IOException, ParseException
STITree
implementation of the MutableTree
interface. readTree(Tree)
can be used to read the tree structure into
a different tree implementation.
java.io.IOException
ParseException
public java.lang.String readTreeName() throws java.io.IOException, ParseException
java.io.IOException
ParseException
public boolean isNextRooted() throws java.io.IOException, ParseException
true
if the tree that will be parsed by the next call
to readTree
is rooted.
ParseException
- if the rootedness of this tree cannot be determined due to
a syntax error. Once this exception is thrown, this object may not parse remaining
trees correctly.
java.io.IOException
public void readTree(STITree<java.lang.Double> tree) throws java.io.IOException, ParseException
tree
-
java.io.IOException
ParseException
public void readTree(MutableTree tree) throws java.io.IOException, ParseException
tree
should be a newly created tree, with no other structure in it. The structure of
the tree that is read will be pushed directly into the tree data structure underneath the root.
java.io.IOException
ParseException
public boolean reachedEOF() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |