@Override
 public void replaceSlidableChildren(NodeRef node, NodeRef lft, NodeRef rgt) {
   int nn = node.getNumber();
   int lftn = lft.getNumber();
   int rgtn = rgt.getNumber();
   assert pionodes[nn].lft >= 0;
   pionodes[nn].lft = lftn;
   pionodes[nn].rgt = rgtn;
   pionodes[lftn].anc = pionodes[nn].nodeNumber;
   pionodes[rgtn].anc = pionodes[nn].nodeNumber;
 }
Example #2
0
 private static AVLTree removeMinBinding(AVLTree t, NodeRef noderemoved) {
   assert !t.isEmpty();
   if (t.left().isEmpty()) {
     noderemoved.node = t;
     return t.right();
   }
   return balance(removeMinBinding(t.left(), noderemoved), t.key(), t.value(), t.right());
 }
 @Override
 public NodeRef getSlidableChild(NodeRef node, int j) {
   int n = node.getNumber();
   return j == 0 ? pionodes[pionodes[n].lft] : pionodes[pionodes[n].rgt];
 }
 @Override
 public boolean isExternalSlidable(NodeRef node) {
   return (pionodes[node.getNumber()].lft < 0);
 }
 @Override
 public void setSlidableNodeHeight(NodeRef node, double height) {
   assert node == pionodes[node.getNumber()];
   ((PopsIONode) node).height = height;
 }
 @Override
 public double getSlidableNodeHeight(NodeRef node) {
   assert node == pionodes[node.getNumber()];
   return ((PopsIONode) node).getHeight();
 }
 @Override
 public Taxon getSlidableNodeTaxon(NodeRef node) {
   assert node == pionodes[node.getNumber()];
   return ((PopsIONode) node).getTaxon();
 }
 @Override
 public void replaceSlidableRoot(NodeRef newroot) {
   rootn = newroot.getNumber();
   pionodes[rootn].anc = -1;
 }