private void swap ( int a , int b ) { // INV: assertExpr(a > 0); // INV: assertExpr(a <= size); // INV: assertExpr(b > 0); // INV: assertExpr(b <= size); // INV: assertExpr(queue[a] != null); // INV: assertExpr(queue[b] != null); // INV: assertExpr(queue[a].index == a); // INV: assertExpr(queue[b].index == b); TimeoutExtImpl temp = queue [ a ] ; queue [ a ] = queue [ b ] ; queue [ a ] . index = a ; queue [ b ] = temp ; queue [ b ] . index = b ; }
Swap two nodes in the tree .