Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document.io.newick
Class NewickStringReader

    java.lang.Object
      info.bioinfweb.treegraph.document.io.newick.NewickStringChars
          info.bioinfweb.treegraph.document.io.newick.NewickStringReader

    public class NewickStringReader

extends NewickStringChars

This class converts a tree in the newick format to a `Document`. First the string is decomposed into Tokens by a `NewickParser` and then the developed token list is syntactically analyzed. The following grammar is used:
`
Tree --> Branch TERMINAL_SYMBOL
Subtree --> Leaf | Internal
Leaf --> Name
Internal --> SUBTREE_START BranchList SUBTREE_END Name
BranchList --> Branch | Branch ELEMENT_SEPERATOR BranchList
Branch --> Subtree Length
Name --> ε | NAME
Length --> ε | LENGTH
`
Note that this grammar differs from the usual Newick grammar becuase it allows the root node to have a branch length.

Author:
  Ben Stöver

Field Summary
`static NodeNameAdapter` | `LEAF_ADAPTER`

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
`NewickStringReader()`

Method Summary
`static Tree` | `read(java.lang.String newick)`
`static Tree` | `read(java.lang.String newick, NodeDataAdapter internalAdapter)`
`static Tree` | `read(java.lang.String newick, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static Node` | `readBranch(java.util.Vector<NewickToken> tokens, int start, int end, Node root, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static void` | `readBranchList(java.util.Vector<NewickToken> tokens, int start, int end, Node root, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static Node` | `readInternal(java.util.Vector<NewickToken> tokens, int start, int end, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static Node` | `readLeaf(java.util.Vector<NewickToken> tokens, int start, int end, TranslTable translTable)`
`private static void` | `readName(java.util.Vector<NewickToken> tokens, int previousEnd, int end, Node root, NodeDataAdapter internalAdapter, TranslTable translTable)`
`private static Node` | `readSubtree(java.util.Vector<NewickToken> tokens, int start, int end, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static Tree` | `readTree(java.util.Vector<NewickToken> tokens, NodeDataAdapter internalAdapter, TranslTable translTable, boolean translateInternals)`
`private static int` | `searchSubtreeEnd(java.util.Vector<NewickToken> tokens, int start, int end)`
`private static int` | `searchToken(java.util.Vector<NewickToken> tokens, int start, int end, TokenType type)`

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`

Field Detail

### LEAF_ADAPTER

    public static final NodeNameAdapter LEAF_ADAPTER

Constructor Detail

### NewickStringReader

    public NewickStringReader()

Method Detail

### searchSubtreeEnd

    private static int searchSubtreeEnd(java.util.Vector<NewickToken> tokens,
                                        int start,
                                        int end)

### searchToken

    private static int searchToken(java.util.Vector<NewickToken> tokens,
                                   int start,
                                   int end,
                                   TokenType type)

### readBranch

    private static Node readBranch(java.util.Vector<NewickToken> tokens,
                                   int start,
                                   int end,
                                   Node root,
                                   NodeDataAdapter internalAdapter,
                                   TranslTable translTable,
                                   boolean translateInternals)
                            throws NewickException

  Throws:
    `NewickException`

### readBranchList

    private static void readBranchList(java.util.Vector<NewickToken> tokens,
                                       int start,
                                       int end,
                                       Node root,
                                       NodeDataAdapter internalAdapter,
                                       TranslTable translTable,
                                       boolean translateInternals)
                                throws NewickException

  Throws:
    `NewickException`

### readName

    private static void readName(java.util.Vector<NewickToken> tokens,
                                 int previousEnd,
                                 int end,
                                 Node root,
                                 NodeDataAdapter internalAdapter,
                                 TranslTable translTable)
                          throws NewickException

  Throws:
    `NewickException`

### readInternal

    private static Node readInternal(java.util.Vector<NewickToken> tokens,
                                     int start,
                                     int end,
                                     NodeDataAdapter internalAdapter,
                                     TranslTable translTable,
                                     boolean translateInternals)
                              throws NewickException

  Throws:
    `NewickException`

### readLeaf

    private static Node readLeaf(java.util.Vector<NewickToken> tokens,
                                 int start,
                                 int end,
                                 TranslTable translTable)
                          throws NewickException

  Throws:
    `NewickException`

### readSubtree

    private static Node readSubtree(java.util.Vector<NewickToken> tokens,
                                    int start,
                                    int end,
                                    NodeDataAdapter internalAdapter,
                                    TranslTable translTable,
                                    boolean translateInternals)
                             throws NewickException

  Throws:
    `NewickException`

### readTree

    private static Tree readTree(java.util.Vector<NewickToken> tokens,
                                 NodeDataAdapter internalAdapter,
                                 TranslTable translTable,
                                 boolean translateInternals)
                          throws NewickException

  Throws:
    `NewickException`

### read

    public static Tree read(java.lang.String newick)
                     throws NewickException

  Throws:
    `NewickException`

### read

    public static Tree read(java.lang.String newick,
                            NodeDataAdapter internalAdapter)
                     throws NewickException

  Throws:
    `NewickException`

### read

    public static Tree read(java.lang.String newick,
                            NodeDataAdapter internalAdapter,
                            TranslTable translTable,
                            boolean translateInternals)
                     throws NewickException

  Throws:
    `NewickException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD