public interface IRaba extends Iterable<byte[]>
IIndexProcedure
s. The interface defines optional operations for
mutation. If mutation is supported, then isReadOnly()
will return
false
. An IRaba
instance either stores B+Tree keys and
supports search(byte[])
-or- stores B+Tree values and allows
null
s but does not support search. for storing null
s and search are mutually exclusive. Some IRaba
implementations may
be used for either purpose, but the IRaba
instance is always either
B+Tree keys or B+Tree values. In both cases, the IRaba
stores
variable length byte[]s. However, when an IRaba
stores B+Tree keys,
the byte[]s interpreted as unsigned byte[]
s for the purpose of
search(byte[])
.
unsigned byte[]
keys and
null
s ARE NOT permitted.
byte[]
s, does NOT
support search(byte[])
and null
s are allowed.Modifier and Type | Method and Description |
---|---|
int |
add(byte[] a)
Append a byte[] value to the end of the logical byte[][] (optional
operation).
|
int |
add(byte[] value,
int off,
int len)
Append a byte[] value to the end of the logical byte[][] (optional
operation).
|
int |
add(DataInput in,
int len)
Append a byte[] value to the end of the logical byte[][] (optional
operation).
|
int |
capacity()
The capacity of the logical byte[][].
|
int |
copy(int index,
OutputStream os)
Copy the value at the specified index onto the output stream.
|
byte[] |
get(int index)
Return the byte[] at the specified index.
|
boolean |
isEmpty()
True iff the logical byte[][] is empty.
|
boolean |
isFull()
True iff the logical byte[][] is full.
|
boolean |
isKeys()
|
boolean |
isNull(int index)
Return
true iff the byte[] at that index is
null . |
boolean |
isReadOnly()
Return
true if this implementation is read-only. |
Iterator<byte[]> |
iterator()
Iterator visits the byte[] elements in the view order.
|
int |
length(int index)
The length of the byte[] at that index.
|
int |
search(byte[] searchKey)
Search for the given searchKey in the key buffer (optional
operation).
|
void |
set(int index,
byte[] a)
Set the byte[] value at the specified index (optional operation).
|
int |
size()
The #of entries in the logical byte[][].
|
boolean isReadOnly()
true
if this implementation is read-only.boolean isKeys()
true
the IRaba
supports search and elements are
interpreted as unsigned byte[]
s (B+Tree keys). For this case
the application MUST ensure that the elements are maintained in
unsigned byte[]
order and that duplicates byte[]s are not
stored.
When false
, the IRaba
allows null
s and
the elements are interpreted as signed byte[]
(B+Tree
values).
true
if the IRaba
represents B+Tree keys and
false
if it represents B+Tree values.int capacity()
int size()
boolean isEmpty()
boolean isFull()
boolean isNull(int index)
true
iff the byte[] at that index is
null
. If isKeys()
would return
true
then this method MUST return false
since
null
s are not permitted for B+Tree keys.index
- The index in [0:size()
-1].IndexOutOfBoundsException
- unless index is in [0:size()
-1].int length(int index)
index
- The index in [0:size()
-1].NullPointerException
- if the key at that index is null
.IndexOutOfBoundsException
- unless index is in [0:size()
-1].byte[] get(int index)
index
- The index in [0:size()
-1].null
if a
null
value was stored at that index.IndexOutOfBoundsException
- unless index is in [0:size()
-1].int copy(int index, OutputStream os)
ByteArrayBuffer
so that the same backing
byte[] can be overwritten by each visited key.index
- The index in [0:size()
-1].out
- The output stream onto which the key will be copied.IndexOutOfBoundsException
- unless index is in [0:size()
-1].NullPointerException
- if the byte[] value at that index is null
.RuntimeException
- if the OutputStream
throws an IOException
(generally the OutputStream
is writing onto a byte[]
so it is more convenient to masquerade this exception).Iterator<byte[]> iterator()
null
, then the iterator will report a null
for
that element.void set(int index, byte[] a)
index
- The index in [0:size()
-1].a
- The byte[] value.IndexOutOfBoundsException
- unless index is in [0:size()
-1].IllegalArgumentException
- if the value is null
and null values are not
supported by this implementation.int add(byte[] a)
a
- A value.IllegalArgumentException
- if the value is null
and null values are not
supported by this implementation.int add(byte[] value, int off, int len)
value
- A valueoff
- The offset of the first byte to be copied.len
- The #of bytes to be copied.IllegalArgumentException
- if the value is null
.int add(DataInput in, int len) throws IOException
in
- The input stream from which the byte[] will be read.len
- The #of bytes to be read.IllegalArgumentException
- if in is null
.IOException
int search(byte[] searchKey)
entryIndex = -entryIndex - 1or just
entryIndex = -entryIndexif you are looking for the first key after the searchKey.
searchKey
- The search key.(-(insertion point) - 1)
. The insertion point is
defined as the point at which the key would be inserted. Note
that this guarantees that the return value will be >= 0 if and
only if the key is found.IllegalArgumentException
- if the searchKey is null.UnsupportedOperationException
- if search is not supported.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.