public final class LongInterval extends AbstractLongSortedSet implements LongSortedSet, Serializable
Interval for details.| Modifier and Type | Field and Description |
|---|---|
long |
left
The left extreme of the interval.
|
long |
right
The right extreme of the interval.
|
| Modifier | Constructor and Description |
|---|---|
protected |
LongInterval(long left,
long right)
Builds an interval with given extremes.
|
| Modifier and Type | Method and Description |
|---|---|
LongComparator |
comparator() |
int |
compareTo(int x)
Compares this interval to an integer.
|
int |
compareTo(int x,
int radius)
Compares this interval to an integer with a specified radius.
|
int |
compareTo(int x,
int leftRadius,
int rightRadius)
Compares this interval to an integer with specified left and right radii.
|
boolean |
contains(int x)
Checks whether this interval contains the specified integer.
|
boolean |
contains(int x,
int radius)
Checks whether this interval would contain the specified integer if enlarged in both
directions by the specified radius.
|
boolean |
contains(int x,
int leftRadius,
int rightRadius)
Checks whether this interval would contain the specified integer if enlarged in each
direction with the respective radius.
|
boolean |
contains(LongInterval interval)
Checks whether this interval contains the specified interval.
|
boolean |
equals(Object o)
Checks whether this interval is equal to another set of integers.
|
long |
firstLong() |
int |
hashCode() |
LongSortedSet |
headSet(long to) |
LongBidirectionalIterator |
iterator()
Returns an iterator over the integers in this interval.
|
LongBidirectionalIterator |
iterator(long from)
Returns an iterator over the integers in this interval larger than or equal to a given integer.
|
long |
lastLong() |
long |
length()
Returns the interval length, that is, the number of integers
contained in the interval.
|
int |
size()
An alias for
length() miminised with Integer.MAX_VALUE. |
long |
size64()
An alias for
length(). |
LongSortedSet |
subSet(long from,
long to) |
LongSortedSet |
tailSet(long from) |
String |
toString() |
static LongInterval |
valueOf(long point)
Returns a one-point interval.
|
static LongInterval |
valueOf(long left,
long right)
Returns an interval with given extremes.
|
first, headSet, last, longIterator, subSet, tailSetrem, remove, removeadd, add, addAll, addAll, contains, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArrayclearclone, finalize, getClass, notify, notifyAll, wait, wait, waitheadSet, longIterator, subSet, tailSetadd, addAll, contains, containsAll, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArraypublic final long left
public final long right
protected LongInterval(long left,
long right)
You cannot generate an empty interval with this constructor. Use Intervals.EMPTY_INTERVAL instead.
left - the left extreme.right - the right extreme (which must be greater than
or equal to the left extreme).public static LongInterval valueOf(long left, long right)
You cannot obtain an empty interval with this factory method. Use Intervals.EMPTY_INTERVAL instead.
left - the left extreme.right - the right extreme (which must be greater than
or equal to the left extreme).public static LongInterval valueOf(long point)
You cannot obtain an empty interval with this factory method. Use Intervals.EMPTY_INTERVAL instead.
point - a point.public long length()
public int size()
length() miminised with Integer.MAX_VALUE.size in interface Collection<Long>size in interface Set<Long>size in class AbstractCollection<Long>Integer.MAX_VALUE.public long size64()
length().public LongBidirectionalIterator iterator()
iterator in interface LongCollectioniterator in interface LongIterableiterator in interface LongSetiterator in interface LongSortedSetiterator in interface Iterable<Long>iterator in interface Collection<Long>iterator in interface Set<Long>iterator in class AbstractLongSortedSetpublic LongBidirectionalIterator iterator(long from)
iterator in interface LongSortedSetfrom - the starting integer.public boolean contains(int x)
public boolean contains(LongInterval interval)
interval - an interval.interval.public boolean contains(int x,
int radius)
public boolean contains(int x,
int leftRadius,
int rightRadius)
public int compareTo(int x)
public int compareTo(int x,
int radius)
public int compareTo(int x,
int leftRadius,
int rightRadius)
x - an integer.leftRadius - the left radius.rightRadius - the right radius.x is positioned
at the left, belongs, or is positioned to the right of this interval enlarged by leftRadius
on the left and rightRadius in the right, that is,
as x < left−leftRadius,
left−leftRadius ≤ x ≤ right+rightRadius or
right+rightRadius < x.public LongComparator comparator()
comparator in interface LongSortedSetcomparator in interface SortedSet<Long>public LongSortedSet headSet(long to)
headSet in interface LongSortedSetpublic LongSortedSet tailSet(long from)
tailSet in interface LongSortedSetpublic LongSortedSet subSet(long from, long to)
subSet in interface LongSortedSetpublic long firstLong()
firstLong in interface LongSortedSetpublic long lastLong()
lastLong in interface LongSortedSetpublic String toString()
toString in class AbstractLongCollectionpublic int hashCode()
hashCode in interface Collection<Long>hashCode in interface Set<Long>hashCode in class AbstractLongSetpublic boolean equals(Object o)
equals in interface Collection<Long>equals in interface Set<Long>equals in class AbstractLongSeto - an object.o is an ordered set of integer containing
the same element of this interval in the same order, or if o
is a set of integers containing the same elements of this interval.