Top Description Fields Constructors Methods
net.sf.ehcache.store.disk.ods

public Class Region

extends AATreeSet.AbstractTreeNode<Comparable<T>>
implements Comparable<Comparable<T>>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Class that represents the regions held within this set.
Author
Chris Dennis

Field Summary

Modifier and TypeField and Description
private long
private long
private long

Constructor Summary

AccessConstructor and Description
public
Region(long value)

Creates a region containing just the single given value

public
Region(long start, long end)

Creates a region containing the given range of value (inclusive).

public
Region(Region r)

Create a shallow copy of a region.

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(Comparable<T>
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Compares this object with the specified object for order.
private int
compareTo(Region
the object to be compared.
r
)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Compares this object with the specified object for order.
private int
compareTo(Long
the object to be compared.
l
)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Compares this object with the specified object for order.
public long
contiguous()

Return the size of the largest region linked from this node.

public long
end()

Returns the end of this range (inclusive).

public Region
getPayload()

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.getPayload.

Return the 'value' object held within this node.
protected boolean
isNull()

Return true if this region is null, i.e. represents no valid range.

protected void
merge(Region
region to merge
r
)

Merge the supplied region into this region (if they are adjoining).

protected Region

Returns:

a possible extra region to be added, or null if none is required
remove
(Region
region to remove
r
)

Remove the supplied region from this region.

public void
public void
public long
size()

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

public long
start()

Returns the start of this range (inclusive).

public void
swapPayload(AATreeSet.Node<Comparable<T>> other)

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.swapPayload.

Swap the payload objects between this node and the supplied node.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private void
Inherited from net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode:
decrementLevelgetLeftgetLevelgetRightincrementLevelsetLevel

Field Detail

contiguousback to summary
private long contiguous
endback to summary
private long end
startback to summary
private long start

Constructor Detail

Regionback to summary
public Region(long value)

Creates a region containing just the single given value

Regionback to summary
public Region(long start, long end)

Creates a region containing the given range of value (inclusive).

Regionback to summary
public Region(Region r)

Create a shallow copy of a region.

The new Region has NULL left and right children.

Method Detail

compareToback to summary
public int compareTo(Comparable<T> other)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:Comparable<T>

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareToback to summary
private int compareTo(Region r)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
r:Region

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareToback to summary
private int compareTo(Long l)

Implements java.lang.Comparable.compareTo, net.sf.ehcache.store.disk.ods.AATreeSet.Node.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
l:Long

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

contiguousback to summary
public long contiguous()

Return the size of the largest region linked from this node.

endback to summary
public long end()

Returns the end of this range (inclusive).

getPayloadback to summary
public Region getPayload()

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.getPayload.

Doc from net.sf.ehcache.store.disk.ods.AATreeSet.Node.getPayload.

Return the 'value' object held within this node.

isNullback to summary
protected boolean isNull()

Return true if this region is null, i.e. represents no valid range.

mergeback to summary
protected void merge(Region r) throws IllegalArgumentException

Merge the supplied region into this region (if they are adjoining).

Parameters
r:Region

region to merge

Exceptions
IllegalArgumentException:
if the regions are not adjoining
removeback to summary
protected Region remove(Region r) throws IllegalArgumentException

Remove the supplied region from this region.

Parameters
r:Region

region to remove

Returns:Region

a possible extra region to be added, or null if none is required

Exceptions
IllegalArgumentException:
if this region does not completely enclose the supplied region
setLeftback to summary
public void setLeft(AATreeSet.Node<Comparable<T>> l)

Overrides net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode.setLeft.

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.setLeft.

Doc from net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode.setLeft.

Set this node's left child.

Annotations
@Override
setRightback to summary
public void setRight(AATreeSet.Node<Comparable<T>> r)

Overrides net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode.setRight.

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.setRight.

Doc from net.sf.ehcache.store.disk.ods.AATreeSet.AbstractTreeNode.setRight.

Set this node's right child.

Annotations
@Override
sizeback to summary
public long size()

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

startback to summary
public long start()

Returns the start of this range (inclusive).

swapPayloadback to summary
public void swapPayload(AATreeSet.Node<Comparable<T>> other)

Implements net.sf.ehcache.store.disk.ods.AATreeSet.Node.swapPayload.

Doc from net.sf.ehcache.store.disk.ods.AATreeSet.Node.swapPayload.

Swap the payload objects between this node and the supplied node.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
updateContiguousback to summary
private void updateContiguous()