public class IntTreeRangeSet
extends java.lang.Object
IntRangeSet backed by a TreeMap.| Modifier and Type | Method and Description |
|---|---|
void |
add(IntRange rangeToAdd)
Adds the specified range to this
IntRangeSet (optional operation). |
void |
addAll(IntRangeSet other)
Adds all of the ranges from the specified range set to this range set (optional operation).
|
java.util.Set<IntRange> |
asRanges()
Returns a view of the disconnected ranges that make up this
range set.
|
void |
clear()
Removes all ranges from this
IntRangeSet (optional operation). |
IntRangeSet |
complement()
Returns a view of the complement of this
IntRangeSet. |
boolean |
contains(int value)
Determines whether any of this range set's member ranges contains
value. |
static IntTreeRangeSet |
create()
Creates an empty
IntTreeRangeSet instance. |
static IntTreeRangeSet |
create(IntRangeSet rangeSet)
Returns a
IntTreeRangeSet initialized with the ranges in the specified range set. |
boolean |
encloses(IntRange range)
Returns
true if there exists a member range in this range set which
encloses the specified range. |
boolean |
enclosesAll(IntRangeSet 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 IntRangeSet that contains the same ranges
according to IntRange.equals(Object). |
int |
hashCode()
Returns
asRanges().hashCode(). |
boolean |
intersects(IntRange 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. |
IntRange |
rangeContaining(int value)
Returns the unique range from this range set that contains
value, or null if this range set does not contain value. |
void |
remove(IntRange rangeToRemove)
Removes the specified range from this
IntRangeSet (optional operation). |
void |
removeAll(IntRangeSet other)
Removes all of the ranges from the specified range set from this range set (optional
operation).
|
IntRange |
span()
Returns the minimal range which encloses all ranges
in this range set.
|
IntRangeSet |
subRangeSet(IntRange view)
Returns a view of the intersection of this
IntRangeSet with the specified range. |
java.lang.String |
toString()
Returns a readable string representation of this range set.
|
public static IntTreeRangeSet create()
IntTreeRangeSet instance.public static IntTreeRangeSet create(IntRangeSet rangeSet)
IntTreeRangeSet initialized with the ranges in the specified range set.public java.util.Set<IntRange> asRanges()
IntRangeSetIterable.iterator() method return the ranges in increasing order of lower bound
(equivalently, of upper bound).@Nullable public IntRange rangeContaining(int value)
IntRangeSetvalue, or null if this range set does not contain value.rangeContaining in interface IntRangeSetpublic boolean encloses(IntRange range)
IntRangeSettrue if there exists a member range in this range set which
encloses the specified range.encloses in interface IntRangeSetpublic IntRange span()
IntRangeSetpublic void add(IntRange rangeToAdd)
IntRangeSetIntRangeSet (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.
add in interface IntRangeSetpublic void remove(IntRange rangeToRemove)
IntRangeSetIntRangeSet (optional operation). After this
operation, if range.contains(c), this.contains(c) will return false.
If range is empty, this is a no-op.
remove in interface IntRangeSetpublic IntRangeSet complement()
IntRangeSetIntRangeSet.
The returned view supports the IntRangeSet.add(org.datavec.dataframe.util.collections.IntRange) operation if this IntRangeSet supports
IntRangeSet.remove(org.datavec.dataframe.util.collections.IntRange), and vice versa.
public IntRangeSet subRangeSet(IntRange view)
IntRangeSetpublic boolean contains(int value)
IntRangeSetvalue.contains in interface IntRangeSetpublic boolean isEmpty()
IntRangeSettrue if this range set contains no ranges.isEmpty in interface IntRangeSetpublic void clear()
IntRangeSetIntRangeSet (optional operation). After this operation,
this.contains(c) will return false for all c.
This is equivalent to remove(IntRange.all()).
clear in interface IntRangeSetpublic boolean enclosesAll(IntRangeSet other)
IntRangeSettrue 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 IntRangeSet.encloses(org.datavec.dataframe.util.collections.IntRange) each of the ranges in
other.
enclosesAll in interface IntRangeSetpublic void addAll(IntRangeSet other)
IntRangeSetother.
This is equivalent to calling IntRangeSet.add(org.datavec.dataframe.util.collections.IntRange) on each of the ranges in other in turn.
addAll in interface IntRangeSetpublic void removeAll(IntRangeSet other)
IntRangeSetother.contains(c), this.contains(c) will
return false.
This is equivalent to calling IntRangeSet.remove(org.datavec.dataframe.util.collections.IntRange) on each of the ranges in other in
turn.
removeAll in interface IntRangeSetpublic boolean intersects(IntRange otherRange)
IntRangeSettrue 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 IntRangeSetpublic boolean equals(@Nullable
java.lang.Object obj)
IntRangeSettrue if obj is another IntRangeSet that contains the same ranges
according to IntRange.equals(Object).equals in interface IntRangeSetequals in class java.lang.Objectpublic final int hashCode()
IntRangeSetasRanges().hashCode().hashCode in interface IntRangeSethashCode in class java.lang.Objectpublic final java.lang.String toString()
IntRangeSetIntRangeSet consisted of IntRange.closed(1, 3) and IntRange.greaterThan(4),
this might return " [1..3](4..+∞)"}.toString in interface IntRangeSettoString in class java.lang.Object