in java/src/main/java/com/epam/deltix/containers/AvlTree.java [99:117]
private void leftFix(AvlTreeNode<TKey, TValue> node, AvlTreeNode<TKey, TValue> parent)
{
int leftHeight = node.left == null ? 0 : node.left.height;
int rightHeight = node.right == null ? 0 : node.right.height;
if (leftHeight > rightHeight + 1)
{
AvlTreeNode<TKey, TValue> l = node.left;
leftHeight = l.left == null ? 0 : l.left.height;
rightHeight = l.right == null ? 0 : l.right.height;
if (rightHeight > leftHeight)
rotateLeft(l, l.right, node);
rotateRight(node.left, node, parent);
}
leftHeight = node.left == null ? 0 : node.left.height;
rightHeight = node.right == null ? 0 : node.right.height;
node.height = 1 + Math.max(leftHeight, rightHeight);
node.count = 1 + (node.left == null ? 0 : node.left.count) + (node.right == null ? 0 : node.right.count);
}