public class Region extends AATreeSet.AbstractTreeNode<java.lang.Comparable> implements java.lang.Comparable<java.lang.Comparable>
Modifier and Type | Field and Description |
---|---|
private long |
contiguous |
private long |
end |
private long |
start |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Comparable other)
Compare this node to the supplied 'data' object.
|
private int |
compareTo(java.lang.Long l) |
private int |
compareTo(Region r) |
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<java.lang.Comparable> l)
Set this node's left child.
|
void |
setRight(AATreeSet.Node<java.lang.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<java.lang.Comparable> other)
Swap the payload objects between this node and the supplied node.
|
java.lang.String |
toString() |
private void |
updateContiguous() |
decrementLevel, getLeft, getLevel, getRight, incrementLevel, setLevel
public Region(long value)
value
- public Region(long start, long end)
public Region(Region r)
The new Region has NULL left and right children.
public long contiguous()
private void updateContiguous()
public void setLeft(AATreeSet.Node<java.lang.Comparable> l)
AATreeSet.AbstractTreeNode
setLeft
in interface AATreeSet.Node<java.lang.Comparable>
setLeft
in class AATreeSet.AbstractTreeNode<java.lang.Comparable>
public void setRight(AATreeSet.Node<java.lang.Comparable> r)
AATreeSet.AbstractTreeNode
setRight
in interface AATreeSet.Node<java.lang.Comparable>
setRight
in class AATreeSet.AbstractTreeNode<java.lang.Comparable>
public java.lang.String toString()
toString
in class java.lang.Object
public long size()
protected boolean isNull()
protected Region remove(Region r) throws java.lang.IllegalArgumentException
r
- region to removejava.lang.IllegalArgumentException
- if this region does not completely enclose the supplied regionprotected void merge(Region r) throws java.lang.IllegalArgumentException
r
- region to mergejava.lang.IllegalArgumentException
- if the regions are not adjoiningpublic int compareTo(java.lang.Comparable other)
compareTo
in interface java.lang.Comparable<java.lang.Comparable>
compareTo
in interface AATreeSet.Node<java.lang.Comparable>
private int compareTo(Region r)
private int compareTo(java.lang.Long l)
public void swapPayload(AATreeSet.Node<java.lang.Comparable> other)
swapPayload
in interface AATreeSet.Node<java.lang.Comparable>
public Region getPayload()
getPayload
in interface AATreeSet.Node<java.lang.Comparable>
public long start()
public long end()