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

Method rebalance

output/java_guava/1.4.17/TreeMultiset.java:853–869  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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