Package org.chaidb.db.index

Examples of org.chaidb.db.index.Key.compareTo()


        int currIn = 0;
        while (last > first) {
            currIn = (first + last) / 2;
            /* Modified by ben zhang at Aug, 12, 2002 */
            Key tmpKey = getNode(currIn).getKey();
            cmp = tmpKey.compareTo(key);
            if (cmp == 0) return new KeyIndex(true, currIn);
            else if (cmp > 0) // a[currIn] > key
                last = currIn - 1;
            else { // a[currIn] < key
                /*Modified by ben zhang at Aug, 12, 2002 */
 
View Full Code Here


            else if (cmp > 0) // a[currIn] > key
                last = currIn - 1;
            else { // a[currIn] < key
                /*Modified by ben zhang at Aug, 12, 2002 */
                tmpKey = getNode(currIn + 1).getKey();
                int tmp = tmpKey.compareTo(key);
                if (tmp > 0) return new KeyIndex(false, currIn + 1);
                else if (tmp == 0) return new KeyIndex(true, currIn + 1);
                else // a[currIn+1] < key
                    first = currIn + 1;
            }
View Full Code Here

                    first = currIn + 1;
            }
        }
        /*Modified by ben zhang at Aug, 12, 2002*/
        Key tmpKey1 = getNode(first).getKey();
        cmp = tmpKey1.compareTo(key);
        if (cmp > 0) return new KeyIndex(false, first);
        else if (cmp == 0) return new KeyIndex(true, first);
        else return new KeyIndex(false, first + 1);
    }

View Full Code Here

            while (nodeIndexLast > nodeIndexFirst) {
                nodeIndex = (nodeIndexFirst + nodeIndexLast) / 2;
                BTreeNode node = getNode(nodeIndex);
                /*Modified by ben zhang at aug, 12, 2002 */
                Key tmpKey = node.getKey();
                int cmp = tmpKey.compareTo(key);
                if (cmp > 0) {
                    nodeIndexLast = nodeIndex - 1;
                } else if (cmp < 0) {
                    nodeIndexFirst = nodeIndex;
                    if (nodeIndexLast - nodeIndexFirst == 1) {
View Full Code Here

                    nodeIndexFirst = nodeIndex;
                    if (nodeIndexLast - nodeIndexFirst == 1) {
                        BTreeNode node2 = getNode(nodeIndexLast);
                        /*Modified by ben zhang at aug, 12, 2002 */
                        tmpKey = node2.getKey();
                        int cmpResult = tmpKey.compareTo(key);
                        if (cmpResult > 0) {
                            //lock it with shared lock.

                            //update the lowest predecessor must be locked
                            BTreePage nPage = lockAPage(kContext, node.getPageNumber(), oper);
View Full Code Here

            while (nodeIndexLast > nodeIndexFirst) {
                int nodeIndex = (nodeIndexFirst + nodeIndexLast) / 2;
                BTreeNode node = getNode(nodeIndex);
                /* Modified by ben zhang at aug, 12, 2002 */
                Key tmpKey = node.getKey();
                int cmp = tmpKey.compareTo(key);
                if (cmp > 0) {
                    nodeIndexLast = nodeIndex - 1;
                } else if (cmp < 0) {
                    nodeIndexFirst = nodeIndex;
                    if (isLeaf()) nodeIndexFirst++;
View Full Code Here

                    if (isLeaf()) nodeIndexFirst++;
                    else if (nodeIndexLast - nodeIndexFirst == 1) {
                        BTreeNode node2 = getNode(nodeIndexLast);
                        /*Modified by ben zhang at aug, 12, 2002 */
                        tmpKey = node2.getKey();
                        int cmpResult = tmpKey.compareTo(key);
                        if (cmpResult > 0) {
                            BTreePage page = this.lockAPage(kContext, node.getPageNumber(), SEARCH);
                            // unfix the current page
                            buffer.releasePage(pageNumber.getTreeId(), pageNumber, false);

View Full Code Here

        int i = 0;
        for (; i < nodeNumOnPage; i++) {
            btreeNode = getNode(i);
            /*Modified by ben zhang at Aug, 12, 2002. */
            key = btreeNode.getKey();
            if (minKey == null || (includeMinKey ? key.compareTo(minKey) >= 0 : key.compareTo(minKey) > 0)) {
                if (maxKey == null || (includeMaxKey ? key.compareTo(maxKey) <= 0 : key.compareTo(maxKey) < 0))
                    valueList.add(btreeNode.getData(kContext));
                else break;
            }
        }
View Full Code Here

        int i = 0;
        for (; i < nodeNumOnPage; i++) {
            btreeNode = getNode(i);
            /*Modified by ben zhang at Aug, 12, 2002. */
            key = btreeNode.getKey();
            if (minKey == null || (includeMinKey ? key.compareTo(minKey) >= 0 : key.compareTo(minKey) > 0)) {
                if (maxKey == null || (includeMaxKey ? key.compareTo(maxKey) <= 0 : key.compareTo(maxKey) < 0))
                    valueList.add(btreeNode.getData(kContext));
                else break;
            }
        }
View Full Code Here

        for (; i < nodeNumOnPage; i++) {
            btreeNode = getNode(i);
            /*Modified by ben zhang at Aug, 12, 2002. */
            key = btreeNode.getKey();
            if (minKey == null || (includeMinKey ? key.compareTo(minKey) >= 0 : key.compareTo(minKey) > 0)) {
                if (maxKey == null || (includeMaxKey ? key.compareTo(maxKey) <= 0 : key.compareTo(maxKey) < 0))
                    valueList.add(btreeNode.getData(kContext));
                else break;
            }
        }
        return i == nodeNumOnPage;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.