jebl.evolution.io
Class NewickImporter

java.lang.Object
  extended by jebl.evolution.io.NewickImporter
All Implemented Interfaces:
Iterable<Tree>, TreeImporter

public class NewickImporter
extends Object
implements TreeImporter

Author:
Andrew Rambaut, Alexei Drummond

Constructor Summary
NewickImporter(Reader reader, boolean unquotedLabels)
          Constructor
 
Method Summary
 boolean hasTree()
          This can be used to read one tree at a time in a loop: List trees = new ArrayList(); while (hasTree()) { trees.add(importNextTree()); } return whether another tree is available.
 Tree importNextTree()
          Import a single tree
 List<Tree> importTrees()
          Import all the trees
 Iterator<Tree> iterator()
          Returns an iterator over a set of elements of type T.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewickImporter

public NewickImporter(Reader reader,
                      boolean unquotedLabels)
Constructor

Parameters:
reader - tree text
unquotedLabels - if true, try to read unqouted lables containing spaces
Method Detail

iterator

public Iterator<Tree> iterator()
Returns an iterator over a set of elements of type T.

Specified by:
iterator in interface Iterable<Tree>
Returns:
an Iterator.

hasTree

public boolean hasTree()
                throws IOException,
                       ImportException
Description copied from interface: TreeImporter
This can be used to read one tree at a time in a loop: List trees = new ArrayList(); while (hasTree()) { trees.add(importNextTree()); } return whether another tree is available.

Specified by:
hasTree in interface TreeImporter
Throws:
IOException
ImportException

importNextTree

public Tree importNextTree()
                    throws IOException,
                           ImportException
Description copied from interface: TreeImporter
Import a single tree

Specified by:
importNextTree in interface TreeImporter
Returns:
the tree
Throws:
IOException
ImportException

importTrees

public List<Tree> importTrees()
                       throws IOException,
                              ImportException
Description copied from interface: TreeImporter
Import all the trees

Specified by:
importTrees in interface TreeImporter
Returns:
the list of trees
Throws:
IOException
ImportException - Any type of tree is fine.