Class NewickImporter

  • All Implemented Interfaces:
    java.lang.Iterable<Tree>, TreeImporter

    public class NewickImporter
    extends java.lang.Object
    implements TreeImporter
    Version:
    $Id: NewickImporter.java 967 2009-01-07 19:37:06Z matt_kearse $
    Author:
    Andrew Rambaut, Alexei Drummond
    • Constructor Summary

      Constructors 
      Constructor Description
      NewickImporter​(java.io.Reader reader, boolean unquotedLabels)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
      java.util.List<Tree> importTrees()
      Import all the trees
      java.util.Iterator<Tree> iterator()
      Returns an iterator over a set of elements of type T.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • NewickImporter

        public NewickImporter​(java.io.Reader reader,
                              boolean unquotedLabels)
        Constructor
        Parameters:
        reader - tree text
        unquotedLabels - if true, try to read unqouted lables containing spaces
    • Method Detail

      • iterator

        public java.util.Iterator<Tree> iterator()
        Returns an iterator over a set of elements of type T.
        Specified by:
        iterator in interface java.lang.Iterable<Tree>
        Returns:
        an Iterator.
      • hasTree

        public boolean hasTree()
                        throws java.io.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:
        java.io.IOException
        ImportException