public interface SortedSet extends Set, Rollbackable
All elements entered in the set must be mutually comparable; in other words,
k1.compareTo(k2)
or comparator.compare(k1, k2)
must not throw a ClassCastException. The ordering must be consistent
with equals (see {
Set
,
TreeSet
,
SortedMap
,
Collection
,
Comparable
,
Comparator
,
ClassCastException
Modifier and Type | Method and Description |
---|---|
void |
$COMMIT(long timestamp)
Commit changes up to the given timestamp, but not including changes
made at timestamp and afterward.
|
Checkpoint |
$GET$CHECKPOINT()
Get the checkpoint object that monitors this rollbackable object.
|
void |
$RESTORE(long timestamp,
boolean trim)
Restore a previous state to all the private fields of this rollbackable
object.
|
java.lang.Object |
$SET$CHECKPOINT(Checkpoint checkpoint)
Set the checkpoint object of this rollbackable object.
|
java.util.Comparator |
comparator()
Returns the comparator used in sorting this set, or null if it is
the elements' natural ordering.
|
java.lang.Object |
first()
Returns the first (lowest sorted) element in the set.
|
SortedSet |
headSet(java.lang.Object toElement)
Returns a view of the portion of the set strictly less than toElement.
|
java.lang.Object |
last()
Returns the last (highest sorted) element in the set.
|
SortedSet |
subSet(java.lang.Object fromElement,
java.lang.Object toElement)
Returns a view of the portion of the set greater than or equal to
fromElement, and strictly less than toElement.
|
SortedSet |
tailSet(java.lang.Object fromElement)
Returns a view of the portion of the set greater than or equal to
fromElement.
|
java.util.Comparator comparator()
java.lang.Object first()
java.util.NoSuchElementException
- if the set is empty.SortedSet headSet(java.lang.Object toElement)
The returned set throws an IllegalArgumentException any time an element is
used which is out of the range of toElement. Note that the endpoint, toElement,
is not included; if you want this value included, pass its successor object in to
toElement. For example, for Integers, you could request
headSet(new Integer(limit.intValue() + 1))
.
toElement
- the exclusive upper range of the subsetjava.lang.ClassCastException
- if toElement is not comparable to the set
contentsjava.lang.IllegalArgumentException
- if this is a subSet, and toElement is out
of rangejava.lang.NullPointerException
- if toElement is null but the set does not
allow null elementsjava.lang.Object last()
java.util.NoSuchElementException
- if the set is empty.SortedSet subSet(java.lang.Object fromElement, java.lang.Object toElement)
The returned set throws an IllegalArgumentException any time an element is
used which is out of the range of fromElement and toElement. Note that the
lower endpoint is included, but the upper is not; if you want to
change the inclusion or exclusion of an endpoint, pass its successor
object in instead. For example, for Integers, you can request
subSet(new Integer(lowlimit.intValue() + 1),
new Integer(highlimit.intValue() + 1))
to reverse
the inclusiveness of both endpoints.
fromElement
- the inclusive lower range of the subsettoElement
- the exclusive upper range of the subsetjava.lang.ClassCastException
- if fromElement or toElement is not comparable
to the set contentsjava.lang.IllegalArgumentException
- if this is a subSet, and fromElement or
toElement is out of rangejava.lang.NullPointerException
- if fromElement or toElement is null but the
set does not allow null elementsSortedSet tailSet(java.lang.Object fromElement)
The returned set throws an IllegalArgumentException any time an element is
used which is out of the range of fromElement. Note that the endpoint,
fromElement, is included; if you do not want this value to be included, pass its
successor object in to fromElement. For example, for Integers, you could request
tailSet(new Integer(limit.intValue() + 1))
.
fromElement
- the inclusive lower range of the subsetjava.lang.ClassCastException
- if fromElement is not comparable to the set
contentsjava.lang.IllegalArgumentException
- if this is a subSet, and fromElement is
out of rangejava.lang.NullPointerException
- if fromElement is null but the set does not
allow null elementsvoid $COMMIT(long timestamp)
Rollbackable
$COMMIT
in interface Collection
$COMMIT
in interface Rollbackable
$COMMIT
in interface Set
timestamp
- The timestamp.void $RESTORE(long timestamp, boolean trim)
Rollbackable
$RESTORE
in interface Collection
$RESTORE
in interface Rollbackable
$RESTORE
in interface Set
timestamp
- The timestamp taken at the time when the previous
state was recorded.trim
- Whether to delete the records used for the rollback.Checkpoint.rollback(long, boolean)
Checkpoint $GET$CHECKPOINT()
Rollbackable
$GET$CHECKPOINT
in interface Collection
$GET$CHECKPOINT
in interface Rollbackable
$GET$CHECKPOINT
in interface Set
java.lang.Object $SET$CHECKPOINT(Checkpoint checkpoint)
Rollbackable
$SET$CHECKPOINT
in interface Collection
$SET$CHECKPOINT
in interface Rollbackable
$SET$CHECKPOINT
in interface Set
checkpoint
- The new checkpoint object.Checkpoint.setCheckpoint(Checkpoint)