src/main/java/com/workplacesystems/utilsj/collections/TransactionalBidiTreeMap.java
private Node<K,V> getCeilNode(Object lookup, int type) {
        Node<K,V> p = TransactionalBidiTreeMap.this.rootNode[type];
        Object compareval;
        if (p==null)
            return null;
        while (true) {
            compareval = type == KEY ? p.getKey() : p.getValue();
            int cmp =  TransactionalBidiTreeMap.this.compare(Node.NO_CHANGE, lookup, p.getStatus(), compareval, type);
            if (cmp == 0) {
                return p;
            } else if (cmp < 0) {
                if (p.getLeft(type) != null)
                    p = p.getLeft(type);
                else
                    return p;
            } else {
                if (p.getRight(type) != null) {
                    p = p.getRight(type);
                } else {
                    Node<K,V> parent = p.getParent(type);
                    Node<K,V> ch = p;
                    while (parent != null && ch == parent.getRight(type)) {
                        ch = parent;
                        parent = parent.getParent(type);
                    }
                    return parent;
                }
            }
        }
    }
private Node<K,V> getCeilNode(Object lookup, int type) {
        Node<K,V> p = TransactionalBidiTreeMap.this.rootNode[type];
        Object compareval;
        if (p==null)
            return null;
        while (true) {
            compareval = type == KEY ? p.getKey() : p.getValue();
            int cmp =  TransactionalBidiTreeMap.this.compare(Node.NO_CHANGE, lookup, p.getStatus(), compareval, type);
            if (cmp == 0) {
                return p;
            } else if (cmp < 0) {
                if (p.getLeft(type) != null)
                    p = p.getLeft(type);
                else
                    return p;
            } else {
                if (p.getRight(type) != null) {
                    p = p.getRight(type);
                } else {
                    Node<K,V> parent = p.getParent(type);
                    Node<K,V> ch = p;
                    while (parent != null && ch == parent.getRight(type)) {
                        ch = parent;
                        parent = parent.getParent(type);
                    }
                    return parent;
                }
            }
        }
    }
Gets the entry corresponding to the specified key; if no such entry
exists, returns the entry for the least key greater than the specified
key; if no such entry exists (i.e., the greatest key in the Tree is less
than the specified key), returns <tt>null</tt>.