abstract class AbstractRangeSet<C extends java.lang.Comparable> extends java.lang.Object implements RangeSet<C>
RangeSet.| Constructor and Description |
|---|
AbstractRangeSet() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Range<C> range)
Adds the specified range to this
RangeSet (optional operation). |
void |
addAll(RangeSet<C> other)
Adds all of the ranges from the specified range set to this range set (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. |
abstract boolean |
encloses(Range<C> otherRange)
Returns
true if there exists a member range in this range set which encloses the specified range. |
boolean |
enclosesAll(RangeSet<C> other)
Returns
true if for each member range in other there exists a member range in
this range set which encloses it. |
boolean |
equals(java.lang.Object obj)
Returns
true if obj is another RangeSet that contains the same ranges
according to Range.equals(Object). |
int |
hashCode()
Returns
asRanges().hashCode(). |
boolean |
intersects(Range<C> otherRange)
Returns
true if there exists a non-empty range enclosed by both a member range in this
range set and the specified range. |
boolean |
isEmpty()
Returns
true if this range set contains no ranges. |
abstract 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> range)
Removes the specified range from this
RangeSet (optional operation). |
void |
removeAll(RangeSet<C> other)
Removes all of the ranges from the specified range set from this range set (optional
operation).
|
java.lang.String |
toString()
Returns a readable string representation of this range set.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, asDescendingSetOfRanges, asRanges, complement, enclosesAll, removeAll, span, subRangeSetpublic boolean contains(C value)
RangeSetvalue.@CheckForNull public abstract Range<C> rangeContaining(C value)
RangeSetvalue, or null if this range set does not contain value.rangeContaining in interface RangeSet<C extends java.lang.Comparable>public boolean isEmpty()
RangeSettrue if this range set contains no ranges.public void add(Range<C> range)
RangeSetRangeSet (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> range)
RangeSetRangeSet (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 void clear()
RangeSetRangeSet (optional operation). After this operation,
this.contains(c) will return false for all c.
This is equivalent to remove(Range.all()).
public boolean enclosesAll(RangeSet<C> other)
RangeSettrue if for each member range in other there exists a member range in
this range set which encloses it. It follows that this.contains(value) whenever other.contains(value). Returns true if other is empty.
This is equivalent to checking if this range set RangeSet.encloses(com.google.common.collect.Range<C>) each of the ranges in
other.
enclosesAll in interface RangeSet<C extends java.lang.Comparable>public void addAll(RangeSet<C> other)
RangeSetother.
This is equivalent to calling RangeSet.add(com.google.common.collect.Range<C>) on each of the ranges in other in turn.
public void removeAll(RangeSet<C> other)
RangeSetother.contains(c), this.contains(c) will
return false.
This is equivalent to calling RangeSet.remove(com.google.common.collect.Range<C>) on each of the ranges in other in
turn.
public boolean intersects(Range<C> otherRange)
RangeSettrue if there exists a non-empty range enclosed by both a member range in this
range set and the specified range. This is equivalent to calling subRangeSet(otherRange) and testing whether the resulting range set is non-empty.intersects in interface RangeSet<C extends java.lang.Comparable>public abstract boolean encloses(Range<C> otherRange)
RangeSettrue if there exists a member range in this range set which encloses the specified range.public boolean equals(@CheckForNull
java.lang.Object obj)
RangeSettrue if obj is another RangeSet that contains the same ranges
according to Range.equals(Object).public final int hashCode()
RangeSetasRanges().hashCode().public final java.lang.String toString()
RangeSetRangeSet consisted of Range.closed(1, 3) and Range.greaterThan(4), this might
return " [1..3](4..+∞)"}.