gsdi work
[jalview.git] / forester / java / src / org / forester / sdi / TaxonomyAssigner.java
index 3e3fe86..a71e70e 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright (C) 2008-2009 Christian M. Zmasek
 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
 // All rights reserved
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
@@ -15,7 +15,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 // Lesser General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -28,11 +28,10 @@ package org.forester.sdi;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Taxonomy;
-import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 
 public class TaxonomyAssigner extends SDI {
 
-    public TaxonomyAssigner( final Phylogeny gene_tree, final Phylogeny species_tree ) {
+    public TaxonomyAssigner( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SdiException {
         super( gene_tree, species_tree );
         getSpeciesTree().preOrderReId();
         linkNodesOfG();
@@ -41,8 +40,8 @@ public class TaxonomyAssigner extends SDI {
 
     void geneTreePostOrderTraversal( final PhylogenyNode g ) {
         if ( !g.isExternal() ) {
-            for( final PhylogenyNodeIterator iter = g.iterateChildNodesForward(); iter.hasNext(); ) {
-                geneTreePostOrderTraversal( iter.next() );
+            for( int i = 0; i < g.getNumberOfDescendants(); ++i ) {
+                geneTreePostOrderTraversal( g.getChildNode( i ) );
             }
             final PhylogenyNode[] linked_nodes = new PhylogenyNode[ g.getNumberOfDescendants() ];
             for( int i = 0; i < linked_nodes.length; ++i ) {
@@ -65,7 +64,7 @@ public class TaxonomyAssigner extends SDI {
         }
     }
 
-    public static void execute( final Phylogeny gene_tree, final Phylogeny species_tree ) {
+    public static void execute( final Phylogeny gene_tree, final Phylogeny species_tree ) throws SdiException {
         new TaxonomyAssigner( gene_tree, species_tree );
     }
 }