question: private int calculateNodeLogLikelihood ( Tree tree , NodeRef node , Set < Taxon > exclude , double [ ] lnL ) { if ( tree . isExternal ( node ) ) { if ( ! exclude . contains ( tree . getNodeTaxon ( node ) ) ) { if ( includeExternalNodesInLikelihoodCalculation ( ) ) { lnL [ 0 ] += logNodeProbability ( tree , node ) ; } return 1 ; } return 0 ; } else { int count = 0 ; for ( int i = 0 ; i < tree . getChildCount ( node ) ; i ++ ) { NodeRef child = tree . getChild ( node , i ) ; count += calculateNodeLogLikelihood ( tree , child , exclude , lnL ) ; } if ( count == 2 ) { lnL [ 0 ] += logNodeProbability ( tree , node ) ; } return count > 0 ? 1 : 0 ; } }
target:  Alternative likelihood calculation that uses recursion over the tree and allows a list of taxa to exclude