/** * Caller must hold any latch. */ boolean hasKeys() { return searchVecEnd() >= searchVecStart(); }
/** * Returns the highest possible key position, which is an even number. If * node has no keys, return value is negative. Caller must hold any latch. */ int highestKeyPos() { return searchVecEnd() - searchVecStart(); }
/** * Returns the highest possible leaf key position, which is an even * number. If leaf node is empty, return value is negative. Caller must * hold any latch. */ int highestLeafPos() { return searchVecEnd() - searchVecStart(); }
/** * Returns the highest possible internal node position, which is an even * number. Highest position doesn't correspond to a valid key, but instead * a child node position. If internal node has no keys, node has one child * at position zero. Caller must hold any latch. */ int highestInternalPos() { return searchVecEnd() - searchVecStart() + 2; }
/** * Caller must hold any latch. * * @see #countNonGhostKeys */ int numKeys() { return (searchVecEnd() - searchVecStart() + 2) >> 1; }
/** * Caller must hold any latch. */ boolean hasKeys() { return searchVecEnd() >= searchVecStart(); }
/** * Caller must hold any latch. */ boolean hasKeys() { return searchVecEnd() >= searchVecStart(); }
/** * Deletes the first entry, and leaves the garbage field alone. */ void deleteFirstSortLeafEntry() throws IOException { /*P*/ byte[] page = mPage; int start = searchVecStart(); doDeleteLeafEntry(page, p_ushortGetLE(page, start)); searchVecStart(start + 2); }
/** * Returns the highest possible key position, which is an even number. If * node has no keys, return value is negative. Caller must hold any latch. */ int highestKeyPos() { return searchVecEnd() - searchVecStart(); }
/** * @param pos position as provided by binarySearch; must be positive */ byte[] retrieveKey(int pos) throws IOException { final /*P*/ byte[] page = mPage; return retrieveKeyAtLoc(this, page, p_ushortGetLE(page, searchVecStart() + pos)); }
/** * Returns highest leaf or internal position. Caller must hold any latch. */ int highestPos() { int pos = searchVecEnd() - searchVecStart(); if (!isLeaf()) { pos += 2; } return pos; }
/** * Applicable only to leaf nodes. Caller must hold any latch. */ int countNonGhostKeys() { return countNonGhostKeys(searchVecStart(), searchVecEnd()); }
private void clearEntries() { garbage(0); leftSegTail(TN_HEADER_SIZE); int pageSize = pageSize(mPage); rightSegTail(pageSize - 1); // Search vector location must be even. searchVecStart((TN_HEADER_SIZE + ((pageSize - TN_HEADER_SIZE) >> 1)) & ~1); searchVecEnd(searchVecStart() - 2); // inclusive }
private void clearEntries() { garbage(0); leftSegTail(TN_HEADER_SIZE); int pageSize = pageSize(mPage); rightSegTail(pageSize - 1); // Search vector location must be even. searchVecStart((TN_HEADER_SIZE + ((pageSize - TN_HEADER_SIZE) >> 1)) & ~1); searchVecEnd(searchVecStart() - 2); // inclusive }
private void clearEntries() { garbage(0); leftSegTail(TN_HEADER_SIZE); int pageSize = pageSize(mPage); rightSegTail(pageSize - 1); // Search vector location must be even. searchVecStart((TN_HEADER_SIZE + ((pageSize - TN_HEADER_SIZE) >> 1)) & ~1); searchVecEnd(searchVecStart() - 2); // inclusive }
/** * @param pos position as provided by binarySearch; must be positive * @return Cursor.NOT_LOADED if value exists, null if ghost */ byte[] hasLeafValue(int pos) { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); loc += keyLengthAtLoc(page, loc); return p_byteGet(page, loc) == -1 ? null : Cursor.NOT_LOADED; }
/** * @param pos position as provided by binarySearch; must be positive * @return null if ghost */ byte[] retrieveLeafValue(int pos) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); loc += keyLengthAtLoc(page, loc); return retrieveLeafValueAtLoc(this, page, loc); }
/** * @param pos position as provided by binarySearch; must be positive * @return null if ghost */ byte[] retrieveLeafValue(int pos) throws IOException { final /*P*/ byte[] page = mPage; int loc = p_ushortGetLE(page, searchVecStart() + pos); loc += keyLengthAtLoc(page, loc); return retrieveLeafValueAtLoc(this, page, loc); }
/** * Caller must hold any latch. */ int availableLeafBytes() { return garbage() + searchVecStart() - searchVecEnd() - leftSegTail() + rightSegTail() + (1 - 2); }
/** * Caller must hold any latch. */ int availableLeafBytes() { return garbage() + searchVecStart() - searchVecEnd() - leftSegTail() + rightSegTail() + (1 - 2); }