* @return LCA of node1 and node2
*/
public final static PhylogenyNode calculateLCA( PhylogenyNode node1, PhylogenyNode node2 ) {
+ if ( node1 == null ) {
+ throw new IllegalArgumentException( "first argument (node) is null" );
+ }
+ if ( node2 == null ) {
+ throw new IllegalArgumentException( "second argument (node) is null" );
+ }
if ( node1 == node2 ) {
return node1;
}
* @return LCA of node1 and node2
*/
public final static PhylogenyNode calculateLCAonTreeWithIdsInPreOrder( PhylogenyNode node1, PhylogenyNode node2 ) {
+ if ( node1 == null ) {
+ throw new IllegalArgumentException( "first argument (node) is null" );
+ }
+ if ( node2 == null ) {
+ throw new IllegalArgumentException( "second argument (node) is null" );
+ }
while ( node1 != node2 ) {
if ( node1.getId() > node2.getId() ) {
node1 = node1.getParent();
* a reference Phylogeny
* @param to_be_stripped
* Phylogeny to be stripped
- * @return number of external nodes removed from to_be_stripped
+ * @return nodes removed from to_be_stripped
*/
- public static int taxonomyBasedDeletionOfExternalNodes( final Phylogeny reference, final Phylogeny to_be_stripped ) {
+ public static List<PhylogenyNode> taxonomyBasedDeletionOfExternalNodes( final Phylogeny reference,
+ final Phylogeny to_be_stripped ) {
final Set<String> ref_ext_taxo = new HashSet<String>();
for( final PhylogenyNodeIterator it = reference.iteratorExternalForward(); it.hasNext(); ) {
final PhylogenyNode n = it.next();
}
to_be_stripped.clearHashIdToNodeMap();
to_be_stripped.externalNodesHaveChanged();
- return nodes_to_delete.size();
+ return nodes_to_delete;
}
/**