edu.jhu.htm.core
Class HTMrange

java.lang.Object
  |
  +--edu.jhu.htm.core.HTMrange

public class HTMrange
extends java.lang.Object

Handles a range of HTM ids using skip lists. This is a neat way to handle large numbers of HTMids. Basically not all ids are stored rather a set of ranges of ids are kept whereby all ids in the range are in the set. This also allows for ranges of different depths to be included in the same list if so required.

  Current Version
  ===============
  ID:	$Id: HTMrange.java,v 1.3 2003/03/05 19:22:24 womullan Exp $
  Revision: 	$Revision: 1.3 $
  Date/time:	$Date: 2003/03/05 19:22:24 $
 

Version:
$Revision $
Author:
George Fekete java port by wil

Field Summary
static int GAP_HISTO_SIZE
           
static int HIGHS
           
static int InclAdjacentXXX
           
static int InclHi
           
static int InclInside
           
static int InclLo
           
static int InclOutside
           
static int INSIDE
           
static int INTERSECT
           
static int LOWS
           
protected  SkipList my_his
           
protected  SkipList my_los
           
static int OUTSIDE
           
static float SKIP_PROB
           
 
Constructor Summary
HTMrange()
           
 
Method Summary
 void addRange(long lo, long hi)
          simply add this range - no checks performed the lo is added to the lows and the high is added to the highs
 long bestgap(int desiredSize)
          return the smallest gapsize at which rangelist would be smaller than desired size
 int compare(HTMrange other)
          this is not imlemented properly
 void defrag()
          merge contiguous ranges
 void defrag(long gap)
          checks that the gap between intervals is at least gap.
 void finalize()
           
 long[] getNext()
          returns the next hlo,hi pair in the long[] this is like an iterator but it can only be used by one thread i.e.
 int isIn(HTMrange otherRange)
          Check if the range contains the given range.
 boolean isIn(long key)
          does the range contain this key calls inside and simplifies answer to boolean
 int isIn(long a, long b)
          Check if the range a to b is contained in this set.
 void levelto(int depth)
          not implemented
 void mergeRange(long lo, long hi)
          Add the given range to this set.
 int nranges()
          return the number of ranges
 void purge()
           
 void reset()
          reset the hi and lo iterators
 long stats(int desiredSize)
           
 int tinside(long mid)
          check if mid is included in this set
 java.lang.String toString()
           
 java.lang.String toString(boolean symbolic)
          converts the lo,his pairs to HTM names if sybolic is true
 java.lang.String toString(int what, boolean symbolic)
          return only his or lows (statics defined on this class) according to what is passed in what.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOWS

public static final int LOWS
See Also:
Constant Field Values

HIGHS

public static final int HIGHS
See Also:
Constant Field Values

INSIDE

public static final int INSIDE
See Also:
Constant Field Values

OUTSIDE

public static final int OUTSIDE
See Also:
Constant Field Values

INTERSECT

public static final int INTERSECT
See Also:
Constant Field Values

GAP_HISTO_SIZE

public static final int GAP_HISTO_SIZE
See Also:
Constant Field Values

SKIP_PROB

public static final float SKIP_PROB
See Also:
Constant Field Values

InclOutside

public static final int InclOutside
See Also:
Constant Field Values

InclInside

public static final int InclInside
See Also:
Constant Field Values

InclLo

public static final int InclLo
See Also:
Constant Field Values

InclHi

public static final int InclHi
See Also:
Constant Field Values

InclAdjacentXXX

public static final int InclAdjacentXXX
See Also:
Constant Field Values

my_los

protected SkipList my_los

my_his

protected SkipList my_his
Constructor Detail

HTMrange

public HTMrange()
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

compare

public int compare(HTMrange other)
this is not imlemented properly


isIn

public int isIn(long a,
                long b)
Check if the range a to b is contained in this set. If both lo and hi are inside some range, and the range numbers agree...


isIn

public boolean isIn(long key)
does the range contain this key calls inside and simplifies answer to boolean


isIn

public int isIn(HTMrange otherRange)
Check if the range contains the given range. for each range in otheRange, see if there is an intersection, total incluwsion or total exclusion


tinside

public int tinside(long mid)
check if mid is included in this set


mergeRange

public void mergeRange(long lo,
                       long hi)
Add the given range to this set. This may subsume other ranges. Or it may be contained in an existing range


addRange

public void addRange(long lo,
                     long hi)
simply add this range - no checks performed the lo is added to the lows and the high is added to the highs


defrag

public void defrag(long gap)
checks that the gap between intervals is at least gap. hence for any hi the gap from the previosu low is at least GAP. This can be used to maintain a maximum number of ranges while introducing some redundancy. Use bestGap to do a calculation for this.


defrag

public void defrag()
merge contiguous ranges


levelto

public void levelto(int depth)
not implemented


purge

public void purge()

reset

public void reset()
reset the hi and lo iterators


nranges

public int nranges()
return the number of ranges


bestgap

public long bestgap(int desiredSize)
return the smallest gapsize at which rangelist would be smaller than desired size


stats

public long stats(int desiredSize)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean symbolic)
                          throws HTMException
converts the lo,his pairs to HTM names if sybolic is true

HTMException

getNext

public long[] getNext()
returns the next hlo,hi pair in the long[] this is like an iterator but it can only be used by one thread i.e. anyone calling getNext advances the iterator. Call reset to reset the iterator to the begining. You must call reset before using this the first time - this is the only way to ensure you are at the start of the sequence. this will return a [0,0] if there is no more data.


toString

public java.lang.String toString(int what,
                                 boolean symbolic)
                          throws java.lang.Exception
return only his or lows (statics defined on this class) according to what is passed in what. Symbolic=true converts thes to HTM names

java.lang.Exception