net.metanotion.util.skiplist
Class SkipLevels

java.lang.Object
  extended by net.metanotion.util.skiplist.SkipLevels
All Implemented Interfaces:
Flushable
Direct Known Subclasses:
BSkipLevels

public class SkipLevels
extends Object
implements Flushable


Field Summary
 SkipSpan bottom
           
 SkipLevels[] levels
           
static int MAX_SIZE
          We can't have more than 2**32 pages
 
Constructor Summary
protected SkipLevels()
           
  SkipLevels(int size, SkipSpan span)
           
 
Method Summary
 boolean blvlck(boolean fix)
           
 boolean blvlck(boolean fix, int width, SkipLevels[] prevLevels)
           
 void flush()
           
 Object get(int start, Comparable key)
           
 SkipSpan getEnd()
           
 SkipSpan getSpan(int start, Comparable key, int[] search)
           
 Comparable key()
           
 void killInstance()
           
 SkipLevels newInstance(int levels, SkipSpan ss, SkipList sl)
           
 String print()
           
 String printAll()
           
 SkipLevels put(int start, Comparable key, Object val, SkipList sl)
           
 Object[] remove(int start, Comparable key, SkipList sl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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[] levels

bottom

public SkipSpan bottom
Constructor Detail

SkipLevels

protected SkipLevels()

SkipLevels

public SkipLevels(int size,
                  SkipSpan span)
Method Detail

newInstance

public SkipLevels newInstance(int levels,
                              SkipSpan ss,
                              SkipList sl)

killInstance

public void killInstance()

flush

public void flush()
Specified by:
flush in interface Flushable

print

public String print()

printAll

public String printAll()

getEnd

public SkipSpan getEnd()

getSpan

public SkipSpan getSpan(int start,
                        Comparable key,
                        int[] search)

key

public Comparable key()

get

public Object get(int start,
                  Comparable key)

remove

public Object[] remove(int start,
                       Comparable key,
                       SkipList 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 put(int start,
                      Comparable key,
                      Object val,
                      SkipList 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[] prevLevels)