GuideTree implements Iterable<GuideTreeNode<S, C>> { @Override public Iterator<GuideTreeNode<S, C>> iterator() { return new PostOrderIterator(); } GuideTree(List<S> sequences, List<PairwiseSequenceScorer<S, C>> scorers); int[] getAllPairsScores(); double[][] getDistanceMatrix(); Node getRoot(); int[][] getScoreMatrix(); List<S> getSequences(); @Override Iterator<GuideTreeNode<S, C>> iterator(); @Override String toString();  }
@Test public void testIterator() { int i = 0; for (GuideTreeNode<ProteinSequence, AminoAcidCompound> n : tree) { switch (i++) { case 0: assertEquals(n.getName(), "1"); break; case 1: assertEquals(n.getName(), "2"); break; case 2: assertEquals(n.getName(), ""); break; case 3: assertEquals(n.getName(), "3"); break; case 4: assertEquals(n.getName(), ""); break; case 5: assertEquals(n.getName(), "4"); break; case 6: assertEquals(n.getName(), ""); break; } } }