K - type of keys, must be comparableV - type of valuespublic class SkipSpan<K extends Comparable<? super K>,V> extends Object implements Flushable
| Modifier and Type | Field and Description |
|---|---|
K[] |
keys
Array of keys
|
static int |
MAX_SIZE
Maximum number of entries in a span (limited by BlockFile.spanSize)
|
SkipSpan<K,V> |
next
Next and previous spans
|
int |
nKeys
Number of keys in this span
|
SkipSpan<K,V> |
prev
Next and previous spans
|
V[] |
vals
Array of values
|
| Modifier | Constructor and Description |
|---|---|
protected |
SkipSpan()
Protected constructor for subclasses.
|
|
SkipSpan(int size)
Create a new SkipSpan with the specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
K |
firstKey()
Get the first key in this span.
|
void |
flush()
Flush this span to disk.
|
V |
get(K key)
Get the value associated with the given key.
|
SkipSpan<K,V> |
getEnd()
Get the end span of this chain.
|
SkipSpan<K,V> |
getSpan(K key,
int[] search)
Get the span containing the given key.
|
void |
killInstance()
Mark this instance as killed.
|
SkipSpan<K,V> |
newInstance(SkipList<K,V> sl)
Create a new instance of this span type.
|
String |
print()
Dump all data from this span to the end.
|
SkipSpan<K,V> |
put(K key,
V val,
SkipList<K,V> sl)
Put a key-value pair into this span.
|
Object[] |
remove(K key,
SkipList<K,V> sl)
Remove a key-value pair from this span.
|
public K extends Comparable<? super K>[] keys
public static final int MAX_SIZE
public SkipSpan<K extends Comparable<? super K>,V> next
public int nKeys
public SkipSpan<K extends Comparable<? super K>,V> prev
public V[] vals
protected SkipSpan()
public SkipSpan(int size)
size - the maximum number of key-value pairsIllegalArgumentException - if size too big or too smallpublic K firstKey()
public V get(K key)
key - the key to search forpublic SkipSpan<K,V> getEnd()
public SkipSpan<K,V> getSpan(K key, int[] search)
key - the key to search forsearch - search parameters and resultspublic void killInstance()
public SkipSpan<K,V> newInstance(SkipList<K,V> sl)
sl - the SkipList to create the span forpublic String print()
public SkipSpan<K,V> put(K key, V val, SkipList<K,V> sl)
key - the keyval - the valuesl - the SkipListpublic Object[] remove(K key, SkipList<K,V> sl)
key - the key to removesl - the SkipList