MCPcopy Create free account
hub / github.com/antlr/codebuff / deleteMe

Method deleteMe

output/java_guava/1.4.18/TreeMultiset.java:787–811  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

785 }
786
787 private AvlNode<E> deleteMe() {
788 int oldElemCount = this.elemCount;
789 this.elemCount = 0;
790 successor(pred, succ);
791 if (left == null) {
792 return right;
793 } else if (right == null) {
794 return left;
795 } else if (left.height >= right.height) {
796 AvlNode<E> newTop = pred;
797 // newTop is the maximum node in my left subtree
798 newTop.left = left.removeMax(newTop);
799 newTop.right = right;
800 newTop.distinctElements = distinctElements - 1;
801 newTop.totalCount = totalCount - oldElemCount;
802 return newTop.rebalance();
803 } else {
804 AvlNode<E> newTop = succ;
805 newTop.right = right.removeMin(newTop);
806 newTop.left = left;
807 newTop.distinctElements = distinctElements - 1;
808 newTop.totalCount = totalCount - oldElemCount;
809 return newTop.rebalance();
810 }
811 }
812
813 // Removes the minimum node from this subtree to be reused elsewhere
814

Callers 2

removeMethod · 0.95
setCountMethod · 0.95

Calls 4

successorMethod · 0.45
removeMaxMethod · 0.45
rebalanceMethod · 0.45
removeMinMethod · 0.45

Tested by

no test coverage detected