private void leftRotate(RBNode x) {
        RBNode y = x.getRightChild();
        x.setRightChild(y.getLeftChild());

        if (y.hasLeftChild()) {
            y.getLeftChild().setParent(x);
        }

        y.setParent(x.getParent());

        if (!x.hasParent()) {
            setRoot(y);
        } else if (x == x.getParent().getLeftChild()) {
            x.getParent().setLeftChild(y);
        } else {
            x.getParent().setRightChild(y);
        }

        y.setLeftChild(x);
        x.setParent(y);
    }