Package net.metanotion.util.skiplist
Class SkipLevels<K extends Comparable<? super K>,V>
- java.lang.Object
-
- net.metanotion.util.skiplist.SkipLevels<K,V>
-
- All Implemented Interfaces:
Flushable
- Direct Known Subclasses:
BSkipLevels
public class SkipLevels<K extends Comparable<? super K>,V> extends Object implements Flushable
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSkipLevels()SkipLevels(int size, SkipSpan<K,V> span)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanblvlck(boolean fix)booleanblvlck(boolean fix, int width, SkipLevels<K,V>[] prevLevels)voidflush()Vget(int start, K key)SkipSpan<K,V>getEnd()SkipSpan<K,V>getSpan(int start, K key, int[] search)Kkey()voidkillInstance()SkipLevels<K,V>newInstance(int levels, SkipSpan<K,V> ss, SkipList<K,V> sl)Stringprint()StringprintAll()SkipLevels<K,V>put(int start, K key, V val, SkipList<K,V> sl)Object[]remove(int start, K key, SkipList<K,V> sl)
-
-
-
Field Detail
-
MAX_SIZE
public static final int MAX_SIZE
We can't have more than 2**32 pages- See Also:
- Constant Field Values
-
levels
public SkipLevels<K extends Comparable<? super K>,V>[] levels
-
bottom
public SkipSpan<K extends Comparable<? super K>,V> bottom
-
-
Method Detail
-
killInstance
public void killInstance()
-
print
public String print()
-
printAll
public String printAll()
-
key
public K key()
-
remove
public Object[] remove(int start, K key, SkipList<K,V> sl)
- Returns:
- An array of two objects or null. rv[0] is the removed object. rv[1] is the deleted SkipLevels if the removed object was the last in the SkipLevels, and the deleted SkipLevels is taller than this SkipLevels. rv is null if no object was removed.
-
put
public SkipLevels<K,V> put(int start, K key, V val, SkipList<K,V> sl)
- Returns:
- the new level if it caused a split and we made a new level, and the new level is taller than our level; else null if it went in an existing level or the new level is our height or less.
-
blvlck
public boolean blvlck(boolean fix)
-
blvlck
public boolean blvlck(boolean fix, int width, SkipLevels<K,V>[] prevLevels)
-
-