|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongSet
it.unimi.dsi.fastutil.longs.AbstractLongSortedSet
it.unimi.dsi.util.LongInterval
public final class LongInterval
An interval of longs. See Interval
for details.
Field Summary | |
---|---|
long |
left
The left extreme of the interval. |
long |
right
The right extreme of the interval. |
Constructor Summary | |
---|---|
protected |
LongInterval(long left,
long right)
Builds an interval with given extremes. |
Method Summary | |
---|---|
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. |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongSortedSet |
---|
first, headSet, last, longIterator, subSet, tailSet |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongSet |
---|
rem, remove, remove |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection |
---|
add, add, addAll, addAll, contains, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray |
Methods inherited from class java.util.AbstractCollection |
---|
clear |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongSortedSet |
---|
headSet, longIterator, subSet, tailSet |
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongSet |
---|
remove |
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection |
---|
add, addAll, contains, containsAll, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArray |
Methods inherited from interface java.util.SortedSet |
---|
first, last |
Methods inherited from interface java.util.Set |
---|
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Field Detail |
---|
public final long left
public final long right
Constructor Detail |
---|
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).Method Detail |
---|
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 LongCollection
iterator
in interface LongIterable
iterator
in interface LongSet
iterator
in interface LongSortedSet
iterator
in interface Iterable<Long>
iterator
in interface Collection<Long>
iterator
in interface Set<Long>
iterator
in class AbstractLongSortedSet
public LongBidirectionalIterator iterator(long from)
iterator
in interface LongSortedSet
from
- the starting integer.
public boolean contains(int x)
x
- an integer.
x
, that is,
whether left
≤ x
≤ right
.public boolean contains(LongInterval interval)
interval
- an interval.
interval
.public boolean contains(int x, int radius)
x
- an integer.radius
- the radius.
radius
would contain x
,
e.g., whether left
−radius
≤ x
≤ right
+radius
.public boolean contains(int x, int leftRadius, int rightRadius)
x
- an integer.leftRadius
- the left radius.rightRadius
- the right radius.
leftRadius
and to the right by rightRadius
would contain x
,
e.g., whether left
−leftRadius
≤ x
≤ right
+rightRadius
.public int compareTo(int x)
x
- an integer.
x
is positioned
at the left, belongs, or is positioned to the right of this interval, e.g.,
as x
< left
,
left
≤ x
≤ right
or
right
< x
.public int compareTo(int x, int radius)
x
- an integer.radius
- the radius.
x
is positioned
at the left, belongs, or is positioned to the right of this interval enlarged by radius
, that is,
as x
< left
−radius
,
left
−radius
≤ x
≤ right
+radius
or
right
+radius
< x
.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 LongSortedSet
comparator
in interface SortedSet<Long>
public LongSortedSet headSet(long to)
headSet
in interface LongSortedSet
public LongSortedSet tailSet(long from)
tailSet
in interface LongSortedSet
public LongSortedSet subSet(long from, long to)
subSet
in interface LongSortedSet
public long firstLong()
firstLong
in interface LongSortedSet
public long lastLong()
lastLong
in interface LongSortedSet
public String toString()
toString
in class AbstractLongCollection
public int hashCode()
hashCode
in interface Collection<Long>
hashCode
in interface Set<Long>
hashCode
in class AbstractLongSet
public boolean equals(Object o)
equals
in interface Collection<Long>
equals
in interface Set<Long>
equals
in class AbstractLongSet
o
- 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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |