h2/src/main/org/h2/mvstore/Page.java
/**
     * Insert a child into this node.
     *
     * @param index the index
     * @param key the key
     * @param childPage the child page
     */
Insert a child into this node.
@param index the index
@param key the key
@param childPage the child page
Insert a child into this node . @param index the index @param key the key @param childPage the child page
public void insertNode(int index, Object key, Page childPage) {
        Object[] newKeys = new Object[keyCount + 1];
        DataUtils.copyWithGap(keys, newKeys, keyCount, index);
        newKeys[index] = key;
        keys = newKeys;
        keyCount++;
        long[] newChildren = new long[childCount + 1];
        DataUtils.copyWithGap(children, newChildren, childCount, index);
        newChildren[index] = childPage.getPos();
        children = newChildren;
        Page[] newChildrenPages = new Page[childCount + 1];
        DataUtils.copyWithGap(childrenPages, newChildrenPages, childCount, index);
        newChildrenPages[index] = childPage;
        childrenPages = newChildrenPages;
        long[] newCounts = new long[childCount + 1];
        DataUtils.copyWithGap(counts, newCounts, childCount, index);
        newCounts[index] = childPage.totalCount;
        counts = newCounts;
        childCount++;
        sharedFlags &= ~(SHARED_KEYS | SHARED_CHILDREN | SHARED_COUNTS);
        totalCount += childPage.totalCount;
        memory += map.getKeyType().getMemory(key);
        memory += DataUtils.PAGE_MEMORY_CHILD;
    }
public void insertNode ( int index , Object key , Page childPage ) { Object [ ] newKeys = new Object [ keyCount + 1 ] ; DataUtils . copyWithGap ( keys , newKeys , keyCount , index ) ; newKeys [ index ] = key ; keys = newKeys ; keyCount ++ ; long [ ] newChildren = new long [ childCount + 1 ] ; DataUtils . copyWithGap ( children , newChildren , childCount , index ) ; newChildren [ index ] = childPage . getPos ( ) ; children = newChildren ; Page [ ] newChildrenPages = new Page [ childCount + 1 ] ; DataUtils . copyWithGap ( childrenPages , newChildrenPages , childCount , index ) ; newChildrenPages [ index ] = childPage ; childrenPages = newChildrenPages ; long [ ] newCounts = new long [ childCount + 1 ] ; DataUtils . copyWithGap ( counts , newCounts , childCount , index ) ; newCounts [ index ] = childPage . totalCount ; counts = newCounts ; childCount ++ ; sharedFlags &= ~ ( SHARED_KEYS | SHARED_CHILDREN | SHARED_COUNTS ) ; totalCount += childPage . totalCount ; memory += map . getKeyType ( ) . getMemory ( key ) ; memory += DataUtils . PAGE_MEMORY_CHILD ; }
Insert a child into this node.
Insert a child into this node .