X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fphylogeny%2FPhylogeny.java;h=9560dfac2ac9366174e8875bae5e4eb5c5a99877;hb=83a8b55648437acc36f0e82ec065db173304f97c;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..9560dfa 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( final PhylogenyNodeIterator it = iteratorPreorder(); it.hasNext(); it.next() ) { + ++c; + } + return c; + } + public int getNumberOfBranches() { if ( isEmpty() ) { return 0;