private final class TreeRangeSet.SubRangeSet extends TreeRangeSet<C>
TreeRangeSet.AsRanges, TreeRangeSet.RangesByUpperBound<C extends java.lang.Comparable<?>>
Modifier and Type | Field and Description |
---|---|
private Range<C> |
restriction |
rangesByLowerBound
Constructor and Description |
---|
SubRangeSet(Range<C> restriction) |
Modifier and Type | Method and Description |
---|---|
void |
add(Range<C> rangeToAdd)
Adds the specified range to this
RangeSet (optional operation). |
void |
clear()
Removes all ranges from this
RangeSet (optional operation). |
boolean |
contains(C value)
Determines whether any of this range set's member ranges contains
value . |
boolean |
encloses(Range<C> range)
Returns
true if there exists a member range in this range set which encloses the specified range. |
Range<C> |
rangeContaining(C value)
Returns the unique range from this range set that contains
value , or null if this range set does not contain value . |
void |
remove(Range<C> rangeToRemove)
Removes the specified range from this
RangeSet (optional operation). |
RangeSet<C> |
subRangeSet(Range<C> view)
Returns a view of the intersection of this
RangeSet with the specified range. |
asDescendingSetOfRanges, asRanges, complement, create, create, create, intersects, span
addAll, enclosesAll, equals, hashCode, isEmpty, removeAll, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, enclosesAll, removeAll
public boolean encloses(Range<C> range)
RangeSet
true
if there exists a member range in this range set which encloses the specified range.@CheckForNull public Range<C> rangeContaining(C value)
RangeSet
value
, or null
if this range set does not contain value
.rangeContaining
in interface RangeSet<C extends java.lang.Comparable<?>>
rangeContaining
in class TreeRangeSet<C extends java.lang.Comparable<?>>
public void add(Range<C> rangeToAdd)
RangeSet
RangeSet
(optional operation). That is, for equal
range sets a and b, the result of a.add(range)
is that a
will be the minimal
range set for which both a.enclosesAll(b)
and a.encloses(range)
.
Note that range
will be coalesced with any ranges in
the range set that are connected with it. Moreover, if
range
is empty, this is a no-op.
public void remove(Range<C> rangeToRemove)
RangeSet
RangeSet
(optional operation). After this
operation, if range.contains(c)
, this.contains(c)
will return false
.
If range
is empty, this is a no-op.
public boolean contains(C value)
RangeSet
value
.public void clear()
RangeSet
RangeSet
(optional operation). After this operation,
this.contains(c)
will return false for all c
.
This is equivalent to remove(Range.all())
.
public RangeSet<C> subRangeSet(Range<C> view)
RangeSet
RangeSet
with the specified range.
The returned view supports all optional operations supported by this RangeSet
, with
the caveat that an IllegalArgumentException
is thrown on an attempt to add any range not enclosed by view
.
subRangeSet
in interface RangeSet<C extends java.lang.Comparable<?>>
subRangeSet
in class TreeRangeSet<C extends java.lang.Comparable<?>>