Class BPlusKeysFixedLong
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.BPlusKeysFixedLong
- All Implemented Interfaces:
BPlusKeys<long[],
TupleBuffer>
-
Constructor Summary
ConstructorDescriptionBPlusKeysFixedLong
(int numKeys, int keyLength) BPlusKeysFixedLong
(long[] keydata, int numKeys, int keyLength) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(long[] key) append key at endint
capacity()
how many keys can be contained?boolean
checkSanity
(String message, long[] minKey, long[] maxKey) check the correct sorting sequence of keysvoid
clear()
remove all keysint
compare
(int index1, int index2) int
compare
(long[] key, int index) compare key with key at index indexint
compare
(long[] key1, long[] key2) compare two keysint
compareBuffer
(TupleBuffer key, int index) int
compareBuffer
(TupleBuffer key, int index, int[] ix) int
compareKey
(long[] key, int index, int[] ix) void
copy
(BPlusKeys<long[], TupleBuffer> b, int numKey) copy numKeys keys into key container b, starting at left most keyvoid
ensureCapacity
(int n, int additionallength) ensures the capacity for n keys (variable number of keys)long[]
get
(int i) return key with index ivoid
getBuffer
(int i, TupleBuffer result, BPlusNode<long[], TupleBuffer> node) int
insert
(long[] key) inserts keyvoid
insertAtIndex
(long[] 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
(long[] 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 numKey) 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
replace
(long[] replacement, int indexToReplace) replaces key by replacement at indexvoid
replace
(long[] key, long[] replacement, int indexToReplace) replaces key by replacementvoid
replaceByBuffer
(TupleBuffer replacement, int indexToReplace) replaces key by replacement at indexint
search
(long[] key, boolean indicateNotContained, boolean indicateContained) 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
(long[] key, int begin, boolean indicateNotContained) 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
(TupleBuffer key, boolean indicateNotContained, boolean indicateContained) int
searchBuffer
(TupleBuffer key, int[] index, int begin, boolean indicateNotContained, boolean next) int
searchBuffer
(TupleBuffer key, int begin, boolean indicateNotContained) int
searchKey
(long[] key, int[] index, int begin, boolean indicateNotContained, boolean next) void
set
(int i, long[] key) set key with index iint
returns the size in bytes for writing the keys to a fileint
split()
where to splitBPlusKeys<long[],
TupleBuffer> splitLeft
(int number, int n) returns left number keys n is the resulting capacity for keysBPlusKeys<long[],
TupleBuffer> splitRight
(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
-
Constructor Details
-
BPlusKeysFixedLong
public BPlusKeysFixedLong(int numKeys, int keyLength) -
BPlusKeysFixedLong
public BPlusKeysFixedLong(long[] keydata, int numKeys, int keyLength)
-
-
Method Details
-
checkSanity
Description copied from interface:BPlusKeys
check the correct sorting sequence of keys- Specified by:
checkSanity
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
clear
public void clear()Description copied from interface:BPlusKeys
remove all keys- Specified by:
clear
in interfaceBPlusKeys<long[],
TupleBuffer>
-
capacity
public int capacity()Description copied from interface:BPlusKeys
how many keys can be contained?- Specified by:
capacity
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
numKeys
public int numKeys()Description copied from interface:BPlusKeys
return the current number of keys- Specified by:
numKeys
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
get
public long[] get(int i) Description copied from interface:BPlusKeys
return key with index i- Specified by:
get
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
getBuffer
- Specified by:
getBuffer
in interfaceBPlusKeys<long[],
TupleBuffer>
-
set
public void set(int i, long[] key) Description copied from interface:BPlusKeys
set key with index i- Specified by:
set
in interfaceBPlusKeys<long[],
TupleBuffer>
-
compare
public int compare(long[] key, int index) Description copied from interface:BPlusKeys
compare key with key at index index- Specified by:
compare
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
compare
public int compare(int index1, int index2) -
compareBuffer
- Specified by:
compareBuffer
in interfaceBPlusKeys<long[],
TupleBuffer>
-
compareBuffer
-
compareKey
public int compareKey(long[] key, int index, int[] ix) -
compare
public int compare(long[] key1, long[] key2) Description copied from interface:BPlusKeys
compare two keys- Specified by:
compare
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
search
public int search(long[] key, boolean indicateNotContained, boolean indicateContained) Description copied from interface:BPlusKeys
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- Specified by:
search
in interfaceBPlusKeys<long[],
TupleBuffer> indicateNotContained
- , if key is not contained returns -1indicateContained
- , if key is contained returns -1- Returns:
-
searchBuffer
- Specified by:
searchBuffer
in interfaceBPlusKeys<long[],
TupleBuffer>
-
searchKey
public int searchKey(long[] key, int[] index, int begin, boolean indicateNotContained, boolean next) -
searchBuffer
public int searchBuffer(TupleBuffer key, int[] index, int begin, boolean indicateNotContained, boolean next) -
search
public int search(long[] key, int begin, boolean indicateNotContained) Description copied from interface:BPlusKeys
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- Specified by:
search
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
searchBuffer
- Specified by:
searchBuffer
in interfaceBPlusKeys<long[],
TupleBuffer>
-
remove
public void remove(int indexToSkip) Description copied from interface:BPlusKeys
remove key at indexToSkip from set of keys- Specified by:
remove
in interfaceBPlusKeys<long[],
TupleBuffer>
-
insert
public int insert(long[] key) Description copied from interface:BPlusKeys
inserts key- Specified by:
insert
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
replace
public void replace(long[] key, long[] replacement, int indexToReplace) Description copied from interface:BPlusKeys
replaces key by replacement- Specified by:
replace
in interfaceBPlusKeys<long[],
TupleBuffer>
-
replaceByBuffer
Description copied from interface:BPlusKeys
replaces key by replacement at index- Specified by:
replaceByBuffer
in interfaceBPlusKeys<long[],
TupleBuffer>
-
replace
public void replace(long[] replacement, int indexToReplace) Description copied from interface:BPlusKeys
replaces key by replacement at index- Specified by:
replace
in interfaceBPlusKeys<long[],
TupleBuffer>
-
insertAtIndex
public void insertAtIndex(long[] key, int indexToInsert) Description copied from interface:BPlusKeys
inserts key at indexToInsert- Specified by:
insertAtIndex
in interfaceBPlusKeys<long[],
TupleBuffer>
-
append
public void append(long[] key) Description copied from interface:BPlusKeys
append key at end- Specified by:
append
in interfaceBPlusKeys<long[],
TupleBuffer>
-
splitLeft
Description copied from interface:BPlusKeys
returns left number keys n is the resulting capacity for keys- Specified by:
splitLeft
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
splitRight
Description copied from interface:BPlusKeys
returns right keys starting at index n is the resulting capacity for keys- Specified by:
splitRight
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
copy
Description copied from interface:BPlusKeys
copy numKeys keys into key container b, starting at left most key- Specified by:
copy
in interfaceBPlusKeys<long[],
TupleBuffer>
-
readFileData
public int readFileData(byte[] fileData, int start, int numKey) Description copied from interface:BPlusKeys
read numkey keys from array of bytes starting at start returns start+number of read bytes- Specified by:
readFileData
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
writeFileData
public int writeFileData(byte[] fileData, int start) Description copied from interface:BPlusKeys
write key data to byte array starting at start Returns start + number of written bytes- Specified by:
writeFileData
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
toString
- Specified by:
toString
in interfaceBPlusKeys<long[],
TupleBuffer> - Overrides:
toString
in classObject
-
sizeInBytes
public int sizeInBytes()Description copied from interface:BPlusKeys
returns the size in bytes for writing the keys to a file- Specified by:
sizeInBytes
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
keySizeInBytes
public int keySizeInBytes(long[] key) Description copied from interface:BPlusKeys
returns the number of bytes needed in addition if key is added- Specified by:
keySizeInBytes
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
ensureCapacity
public void ensureCapacity(int n, int additionallength) Description copied from interface:BPlusKeys
ensures the capacity for n keys (variable number of keys)- Specified by:
ensureCapacity
in interfaceBPlusKeys<long[],
TupleBuffer> additionallength
- , the whole length in bytes for all keys
-
keySizeInBytes
public int keySizeInBytes()Description copied from interface:BPlusKeys
returns the size of a key in bytes if it is fix
otherwise -1 is returned in addition if key is added- Specified by:
keySizeInBytes
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-
split
public int split()Description copied from interface:BPlusKeys
where to split- Specified by:
split
in interfaceBPlusKeys<long[],
TupleBuffer> - Returns:
-