ehcache

net.sf.ehcache.store.disk.ods
Class Region

java.lang.Object
  extended by net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode<Comparable>
      extended by net.sf.ehcache.store.disk.ods.Region
All Implemented Interfaces:
Comparable<Comparable>, AATreeSet.Node<Comparable>

public class Region
extends AATreeSet.AbstractTreeNode<Comparable>
implements Comparable<Comparable>

Class that represents the regions held within this set.

Author:
Chris Dennis

Constructor Summary
Region(long value)
          Creates a region containing just the single given value
Region(long start, long end)
          Creates a region containing the given range of value (inclusive).
Region(Region r)
          Create a shallow copy of a region.
 
Method Summary
 int compareTo(Comparable other)
          Compare this node to the supplied 'data' object.
 long contiguous()
          Return the size of the largest region linked from this node.
 long end()
          Returns the end of this range (inclusive).
 Region getPayload()
          Return the 'value' object held within this node.
protected  boolean isNull()
          Return true if this region is null, i.e.
protected  void merge(Region r)
          Merge the supplied region into this region (if they are adjoining).
protected  Region remove(Region r)
          Remove the supplied region from this region.
 void setLeft(AATreeSet.Node<Comparable> l)
          Set this node's left child.
 void setRight(AATreeSet.Node<Comparable> r)
          Set this node's right child.
 long size()
          Returns the size of this range (the number of values within its bounds).
 long start()
          Returns the start of this range (inclusive).
 void swapPayload(AATreeSet.Node<Comparable> other)
          Swap the payload objects between this node and the supplied node.
 String toString()
          
 
Methods inherited from class net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode
decrementLevel, getLeft, getLevel, getRight, incrementLevel, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Region

public Region(long value)
Creates a region containing just the single given value

Parameters:
value -

Region

public Region(long start,
              long end)
Creates a region containing the given range of value (inclusive).


Region

public Region(Region r)
Create a shallow copy of a region.

The new Region has NULL left and right children.

Method Detail

contiguous

public long contiguous()
Return the size of the largest region linked from this node.


setLeft

public void setLeft(AATreeSet.Node<Comparable> l)
Description copied from class: AATreeSet.AbstractTreeNode
Set this node's left child.

Specified by:
setLeft in interface AATreeSet.Node<Comparable>
Overrides:
setLeft in class AATreeSet.AbstractTreeNode<Comparable>

setRight

public void setRight(AATreeSet.Node<Comparable> r)
Description copied from class: AATreeSet.AbstractTreeNode
Set this node's right child.

Specified by:
setRight in interface AATreeSet.Node<Comparable>
Overrides:
setRight in class AATreeSet.AbstractTreeNode<Comparable>

toString

public String toString()

Overrides:
toString in class Object

size

public long size()
Returns the size of this range (the number of values within its bounds).


isNull

protected boolean isNull()
Return true if this region is null, i.e. represents no valid range.


remove

protected Region remove(Region r)
                 throws IllegalArgumentException
Remove the supplied region from this region.

Parameters:
r - region to remove
Returns:
a possible extra region to be added, or null if none is required
Throws:
IllegalArgumentException - if this region does not completely enclose the supplied region

merge

protected void merge(Region r)
              throws IllegalArgumentException
Merge the supplied region into this region (if they are adjoining).

Parameters:
r - region to merge
Throws:
IllegalArgumentException - if the regions are not adjoining

compareTo

public int compareTo(Comparable other)
Compare this node to the supplied 'data' object.

Specified by:
compareTo in interface Comparable<Comparable>
Specified by:
compareTo in interface AATreeSet.Node<Comparable>

swapPayload

public void swapPayload(AATreeSet.Node<Comparable> other)
Swap the payload objects between this node and the supplied node.

Specified by:
swapPayload in interface AATreeSet.Node<Comparable>

getPayload

public Region getPayload()
Return the 'value' object held within this node.

Specified by:
getPayload in interface AATreeSet.Node<Comparable>

start

public long start()
Returns the start of this range (inclusive).


end

public long end()
Returns the end of this range (inclusive).


ehcache

Copyright 2001-2014, Terracotta, Inc.