X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fphylogeny%2FPhylogeny.java;h=4d0dae60f7e80004edd48668b29b66aa5f95112c;hb=b9fc2ec86790a904b15b7f99710569afbab1326a;hp=1a4892d5433bdfe41724fd80be03984e743b3ab1;hpb=eee996a6476a1e3d84c07f8f690dcde3ff4b2ef5;p=jalview.git diff --git a/forester/java/src/org/forester/phylogeny/Phylogeny.java b/forester/java/src/org/forester/phylogeny/Phylogeny.java index 1a4892d..4d0dae6 100644 --- a/forester/java/src/org/forester/phylogeny/Phylogeny.java +++ b/forester/java/src/org/forester/phylogeny/Phylogeny.java @@ -563,6 +563,21 @@ public class Phylogeny { return nodes.get( 0 ); } + /** + * This is time-inefficient since it runs a iterator each time it is called. + * + */ + public int getNodeCount() { + if ( isEmpty() ) { + return 0; + } + int c = 0; + for( PhylogenyNodeIterator it = iteratorPreorder(); it.hasNext(); it.next() ) { + ++c; + } + return c; + } + public int getNumberOfBranches() { if ( isEmpty() ) { return 0;