private void rotateLeft ( GBSNode bfather , GBSNode bpoint ) { GBSNode bson = bpoint . leftChild ( ) ; if ( bson . balance ( ) == - 1 ) /* Single LL rotation */ { bpoint . setLeftChild ( bson . rightChild ( ) ) ; bson . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( bson ) ; else bfather . setLeftChild ( bson ) ; bpoint . clearBalance ( ) ; bson . clearBalance ( ) ; } else /* Double LR rotation */ { GBSNode blift = bson . rightChild ( ) ; bson . setRightChild ( blift . leftChild ( ) ) ; blift . setLeftChild ( bson ) ; bpoint . setLeftChild ( blift . rightChild ( ) ) ; blift . setRightChild ( bpoint ) ; if ( bfather . rightChild ( ) == bpoint ) bfather . setRightChild ( blift ) ; else bfather . setLeftChild ( blift ) ; bpoint . setBalance ( newBalance2 [ blift . balance ( ) + 1 ] ) ; bson . setBalance ( newBalance1 [ blift . balance ( ) + 1 ] ) ; blift . clearBalance ( ) ; } }
Do an LL or LR rotation .