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

Method rebalance

output/java_guava/1.4.19/TreeMultiset.java:854–870  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

852 }
853
854 private AvlNode<E> rebalance() {
855 switch (balanceFactor()) {
856 case -2:
857 if (right.balanceFactor() > 0) {
858 right = right.rotateRight();
859 }
860 return rotateLeft();
861 case 2:
862 if (left.balanceFactor() < 0) {
863 left = left.rotateLeft();
864 }
865 return rotateRight();
866 default:
867 recomputeHeight();
868 return this;
869 }
870 }
871
872 private int balanceFactor() {
873 return height(left) - height(right);

Callers 6

addMethod · 0.95
removeMethod · 0.95
setCountMethod · 0.95
removeMinMethod · 0.95
removeMaxMethod · 0.95
deleteMeMethod · 0.45

Calls 4

balanceFactorMethod · 0.95
rotateRightMethod · 0.95
rotateLeftMethod · 0.95
recomputeHeightMethod · 0.95

Tested by

no test coverage detected