Home / Development / Documentation / 2.0.44 / NewickScanner
TreeGraph 2
 


info.bioinfweb.treegraph.document.io.newick
Class NewickScanner

java.lang.Object
  extended by info.bioinfweb.treegraph.document.io.newick.NewickStringChars
      extended by info.bioinfweb.treegraph.document.io.newick.NewickScanner

public class NewickScanner
extends NewickStringChars


Field Summary
 
Fields inherited from class info.bioinfweb.treegraph.document.io.newick.NewickStringChars
COMMENT_END, COMMENT_START, ELEMENT_SEPERATOR, FREE_NAME_BLANK, LENGTH_SEPERATOR, NAME_DELIMITER, SUBTREE_END, SUBTREE_START, TERMINAL_SYMBOL
 
Constructor Summary
NewickScanner()
           
 
Method Summary
static List<NewickToken> parse(String text)
           
private static int readBranchLength(String text, int start, NewickToken token)
          Reads a length statement in an Newick string.
private static int readComment(String text, int start, List<NewickToken> tokenList)
          Reads a comment and adds it to last token in the passed list.
private static int readDelimitedName(String text, int start, NewickToken token)
           
private static NewickToken readFreeName(String text, int start)
           
 
Methods inherited from class info.bioinfweb.treegraph.document.io.newick.NewickStringChars
isCharAfterLength, isFreeNameChar, isFreeNameFirstChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewickScanner

public NewickScanner()
Method Detail

readFreeName

private static NewickToken readFreeName(String text,
                                        int start)

readDelimitedName

private static int readDelimitedName(String text,
                                     int start,
                                     NewickToken token)

readBranchLength

private static int readBranchLength(String text,
                                    int start,
                                    NewickToken token)
Reads a length statement in an Newick string.

Parameters:
token - the token where the length value shall be stored
text - the Newick string
start - ste start position of the length statement
Returns:
the position to go on tokenizing

readComment

private static int readComment(String text,
                               int start,
                               List<NewickToken> tokenList)
Reads a comment and adds it to last token in the passed list. If the comment is a rooted- or unrooted-command the according token is added.

Parameters:
text -
start -
tokenList -
Returns:
Throws:
NewickException - if the comment is unterminated

parse

public static List<NewickToken> parse(String text)