apply method for a NodeTransform to nodes in a tree
authorjprocter <Jim Procter>
Mon, 1 Jun 2009 15:45:29 +0000 (15:45 +0000)
committerjprocter <Jim Procter>
Mon, 1 Jun 2009 15:45:29 +0000 (15:45 +0000)
src/jalview/analysis/NJTree.java
src/jalview/datamodel/NodeTransformI.java [new file with mode: 0644]

index fe0df1a..13ba909 100755 (executable)
@@ -1308,7 +1308,16 @@ public class NJTree
   {
     return hasRootDistance;
   }
-
+  /**
+   * apply the given transform to all the nodes in the tree.
+   * @param nodeTransformI
+   */
+  public void applyToNodes(NodeTransformI nodeTransformI)
+  {
+    for (Enumeration nodes = node.elements(); nodes.hasMoreElements(); 
+      nodeTransformI.transform((BinaryNode)nodes.nextElement()))
+      ;
+  }
 }
 
 /**
diff --git a/src/jalview/datamodel/NodeTransformI.java b/src/jalview/datamodel/NodeTransformI.java
new file mode 100644 (file)
index 0000000..f78188a
--- /dev/null
@@ -0,0 +1,13 @@
+/**
+ * 
+ */
+package jalview.datamodel;
+
+/**
+ * @author JimP
+ *
+ */
+public interface NodeTransformI
+{
+  public void transform(BinaryNode node);
+}