question: private static SimpleNode rotateNodeByName ( Tree tree , NodeRef node ) { if ( tree . isExternal ( node ) ) { return new SimpleNode ( tree , node ) ; } else { SimpleNode parent = new SimpleNode ( tree , node ) ; NodeRef child1 = tree . getChild ( node , 0 ) ; NodeRef child2 = tree . getChild ( node , 1 ) ; String subtree1 = uniqueNewick ( tree , child1 ) ; String subtree2 = uniqueNewick ( tree , child2 ) ; if ( subtree1 . compareTo ( subtree2 ) > 0 ) { parent . addChild ( rotateNodeByName ( tree , child2 ) ) ; parent . addChild ( rotateNodeByName ( tree , child1 ) ) ; } else { parent . addChild ( rotateNodeByName ( tree , child1 ) ) ; parent . addChild ( rotateNodeByName ( tree , child2 ) ) ; } return parent ; } }
target:  Recursive function for constructing a newick tree representation in the given buffer.