Package net.sf.ehcache.store.disk.ods
Class Region
- java.lang.Object
-
- net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode<java.lang.Comparable>
-
- net.sf.ehcache.store.disk.ods.Region
-
- All Implemented Interfaces:
java.lang.Comparable<java.lang.Comparable>,AATreeSet.Node<java.lang.Comparable>
public class Region extends AATreeSet.AbstractTreeNode<java.lang.Comparable> implements java.lang.Comparable<java.lang.Comparable>
Class that represents the regions held within this set.- Author:
- Chris Dennis
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Comparable other)Compare this node to the supplied 'data' object.longcontiguous()Return the size of the largest region linked from this node.longend()Returns the end of this range (inclusive).RegiongetPayload()Return the 'value' object held within this node.protected booleanisNull()Return true if this region is null, i.e.protected voidmerge(Region r)Merge the supplied region into this region (if they are adjoining).protected Regionremove(Region r)Remove the supplied region from this region.voidsetLeft(AATreeSet.Node<java.lang.Comparable> l)Set this node's left child.voidsetRight(AATreeSet.Node<java.lang.Comparable> r)Set this node's right child.longsize()Returns the size of this range (the number of values within its bounds).longstart()Returns the start of this range (inclusive).voidswapPayload(AATreeSet.Node<java.lang.Comparable> other)Swap the payload objects between this node and the supplied node.java.lang.StringtoString()-
Methods inherited from class net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode
decrementLevel, getLeft, getLevel, getRight, incrementLevel, setLevel
-
-
-
-
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<java.lang.Comparable> l)
Description copied from class:AATreeSet.AbstractTreeNodeSet this node's left child.- Specified by:
setLeftin interfaceAATreeSet.Node<java.lang.Comparable>- Overrides:
setLeftin classAATreeSet.AbstractTreeNode<java.lang.Comparable>
-
setRight
public void setRight(AATreeSet.Node<java.lang.Comparable> r)
Description copied from class:AATreeSet.AbstractTreeNodeSet this node's right child.- Specified by:
setRightin interfaceAATreeSet.Node<java.lang.Comparable>- Overrides:
setRightin classAATreeSet.AbstractTreeNode<java.lang.Comparable>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.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 java.lang.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:
java.lang.IllegalArgumentException- if this region does not completely enclose the supplied region
-
merge
protected void merge(Region r) throws java.lang.IllegalArgumentException
Merge the supplied region into this region (if they are adjoining).- Parameters:
r- region to merge- Throws:
java.lang.IllegalArgumentException- if the regions are not adjoining
-
compareTo
public int compareTo(java.lang.Comparable other)
Compare this node to the supplied 'data' object.- Specified by:
compareToin interfaceAATreeSet.Node<java.lang.Comparable>- Specified by:
compareToin interfacejava.lang.Comparable<java.lang.Comparable>
-
swapPayload
public void swapPayload(AATreeSet.Node<java.lang.Comparable> other)
Swap the payload objects between this node and the supplied node.- Specified by:
swapPayloadin interfaceAATreeSet.Node<java.lang.Comparable>
-
getPayload
public Region getPayload()
Return the 'value' object held within this node.- Specified by:
getPayloadin interfaceAATreeSet.Node<java.lang.Comparable>
-
start
public long start()
Returns the start of this range (inclusive).
-
end
public long end()
Returns the end of this range (inclusive).
-
-