Interface BPlusKeys<KeyType,KeyBufferType>
- Type Parameters:
KeyType
-
- All Known Implementing Classes:
BPlusKeysFixedLong
,BPlusKeysVariableBytes
public interface BPlusKeys<KeyType,KeyBufferType>
Describes an interface to the keys of a bplus node
- Author:
- angele
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append key at endint
capacity()
how many keys can be contained?boolean
checkSanity
(String message, KeyType minKey, KeyType maxKey) check the correct sorting sequence of keysvoid
clear()
remove all keysint
compare key with key at index indexint
compare two keysint
compareBuffer
(KeyBufferType key, int index) void
copy
(BPlusKeys<KeyType, KeyBufferType> b, int numKeys) copy numKeys keys into key container b, starting at left most keyvoid
ensureCapacity
(int n, int totalLengthInBytes) ensures the capacity for n keys (variable number of keys)get
(int i) return key with index ivoid
getBuffer
(int i, KeyBufferType result, BPlusNode<KeyType, KeyBufferType> node) int
inserts keyvoid
insertAtIndex
(KeyType key, int indexToInsert) inserts key at indexToInsertint
returns the size of a key in bytes if it is fix
otherwise -1 is returned in addition if key is addedint
keySizeInBytes
(KeyType key) returns the number of bytes needed in addition if key is addedint
numKeys()
return the current number of keysint
readFileData
(byte[] fileData, int start, int numKeys) read numkey keys from array of bytes starting at start returns start+number of read bytesvoid
remove
(int indexToSkip) remove key at indexToSkip from set of keysvoid
replaces key by replacement at indexvoid
replaces key by replacementvoid
replaceByBuffer
(KeyBufferType replacement, int index) replaces key by replacement at indexint
search for key if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be addedint
search for key beginning from a start index if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be addedint
searchBuffer
(KeyBufferType key, boolean indicateNotContained, boolean indicateContained) int
searchBuffer
(KeyBufferType key, int begin, boolean indicateNotContained) void
set key with index iint
returns the size in bytes for writing the keys to a fileint
split()
where to splitsplitLeft
(int number, int n) returns left number keys n is the resulting capacity for keyssplitRight
(int index, int n) returns right keys starting at index n is the resulting capacity for keystoString()
int
writeFileData
(byte[] fileData, int start) write key data to byte array starting at start Returns start + number of written bytes
-
Method Details
-
clear
void clear()remove all keys -
capacity
int capacity()how many keys can be contained?- Returns:
-
split
int split()where to split- Returns:
-
numKeys
int numKeys()return the current number of keys- Returns:
-
sizeInBytes
int sizeInBytes()returns the size in bytes for writing the keys to a file- Returns:
-
keySizeInBytes
returns the number of bytes needed in addition if key is added- Parameters:
key
-- Returns:
-
keySizeInBytes
int keySizeInBytes()returns the size of a key in bytes if it is fix
otherwise -1 is returned in addition if key is added- Returns:
-
get
return key with index i- Parameters:
i
-- Returns:
-
getBuffer
-
set
set key with index i- Parameters:
i
-key
-
-
compare
compare key with key at index index- Parameters:
key
-index
-- Returns:
-
compareBuffer
-
compare
compare two keys- Parameters:
key1
-key2
-- Returns:
-
search
search for key if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added- Parameters:
key
-indicateNotContained
- , if key is not contained returns -1indicateContained
- , if key is contained returns -1- Returns:
-
searchBuffer
-
search
search for key beginning from a start index if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added- Parameters:
key
-begin
-indicateNotContained
-- Returns:
-
searchBuffer
-
remove
void remove(int indexToSkip) remove key at indexToSkip from set of keys- Parameters:
indexToSkip
-
-
insert
inserts key- Parameters:
key
-- Returns:
-
replace
replaces key by replacement- Parameters:
key
-replacement
-numKeys
-
-
replace
replaces key by replacement at index- Parameters:
replacement
-index
-
-
replaceByBuffer
replaces key by replacement at index- Parameters:
replacement
-index
-
-
insertAtIndex
inserts key at indexToInsert- Parameters:
key
-indexToInsert
-
-
append
append key at end- Parameters:
key
-
-
splitLeft
returns left number keys n is the resulting capacity for keys- Parameters:
number
-n
-- Returns:
-
splitRight
returns right keys starting at index n is the resulting capacity for keys- Parameters:
index
-n
-- Returns:
-
copy
copy numKeys keys into key container b, starting at left most key- Parameters:
b
-numKeys
-
-
readFileData
int readFileData(byte[] fileData, int start, int numKeys) read numkey keys from array of bytes starting at start returns start+number of read bytes- Parameters:
fileData
-start
-numKeys
-- Returns:
-
writeFileData
int writeFileData(byte[] fileData, int start) write key data to byte array starting at start Returns start + number of written bytes- Parameters:
fileData
-start
-- Returns:
-
ensureCapacity
void ensureCapacity(int n, int totalLengthInBytes) ensures the capacity for n keys (variable number of keys)- Parameters:
n
-totalLengthInBytes
- , the whole length in bytes for all keys
-
checkSanity
check the correct sorting sequence of keys- Returns:
-
toString
String toString()
-