public final class Interval extends it.unimi.dsi.fastutil.ints.AbstractIntSortedSet implements it.unimi.dsi.fastutil.ints.IntSortedSet, Serializable
left and right
extremes, and contains all integers x such that
left ≤ x ≤ right.
This class has no constructor: use the static factory methods
valueOf(int, int) and valueOf(int), instead.
Instances of this class are immutable, and moreover implement
the IntSortedSet interface. The
equality method allows to check equality with
both sorted and non-sorted sets of integers.
To reduce garbage collection, intervals made of one non-negative small points are precomputed and returned upon request.
| Modifier and Type | Field and Description |
|---|---|
int |
left
The left extreme of the interval.
|
int |
right
The right extreme of the interval.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Interval(int left,
int right)
Builds an interval with given extremes.
|
| Modifier and Type | Method and Description |
|---|---|
it.unimi.dsi.fastutil.ints.IntComparator |
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(Interval interval)
Checks whether this interval contains the specified interval.
|
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 |
equals(Object o)
Checks whether this interval is equal to another set of integers.
|
int |
firstInt() |
int |
hashCode() |
it.unimi.dsi.fastutil.ints.IntSortedSet |
headSet(int to) |
it.unimi.dsi.fastutil.ints.IntBidirectionalIterator |
iterator()
Returns an iterator over the integers in this interval.
|
it.unimi.dsi.fastutil.ints.IntBidirectionalIterator |
iterator(int from)
Returns an iterator over the integers in this interval larger than or equal to a given integer.
|
int |
lastInt() |
int |
length()
Returns the interval length, that is, the number of integers
contained in the interval.
|
int |
size()
An alias for
length(). |
it.unimi.dsi.fastutil.ints.IntSortedSet |
subSet(int from,
int to) |
it.unimi.dsi.fastutil.ints.IntSortedSet |
tailSet(int from) |
String |
toString() |
static Interval |
valueOf(int point)
Returns a one-point interval.
|
static Interval |
valueOf(int left,
int right)
Returns an interval with given extremes.
|
first, headSet, intIterator, last, subSet, tailSetadd, add, addAll, addAll, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toIntArray, toIntArrayclearclone, finalize, getClass, notify, notifyAll, wait, wait, waitheadSet, intIterator, subSet, tailSetpublic final int left
public final int right
protected Interval(int left,
int 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 Interval valueOf(int left, int 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 Interval valueOf(int point)
You cannot obtain an empty interval with this factory method. Use Intervals.EMPTY_INTERVAL instead.
point - a point.public int length()
public int size()
length().size in interface Collection<Integer>size in interface Set<Integer>size in class AbstractCollection<Integer>public it.unimi.dsi.fastutil.ints.IntBidirectionalIterator iterator()
iterator in interface it.unimi.dsi.fastutil.ints.IntCollectioniterator in interface it.unimi.dsi.fastutil.ints.IntIterableiterator in interface it.unimi.dsi.fastutil.ints.IntSetiterator in interface it.unimi.dsi.fastutil.ints.IntSortedSetiterator in interface Iterable<Integer>iterator in interface Collection<Integer>iterator in interface Set<Integer>iterator in class it.unimi.dsi.fastutil.ints.AbstractIntSortedSetpublic it.unimi.dsi.fastutil.ints.IntBidirectionalIterator iterator(int from)
iterator in interface it.unimi.dsi.fastutil.ints.IntSortedSetfrom - the starting integer.public boolean contains(int x)
public boolean contains(Interval 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 it.unimi.dsi.fastutil.ints.IntComparator comparator()
comparator in interface it.unimi.dsi.fastutil.ints.IntSortedSetcomparator in interface SortedSet<Integer>public it.unimi.dsi.fastutil.ints.IntSortedSet headSet(int to)
headSet in interface it.unimi.dsi.fastutil.ints.IntSortedSetpublic it.unimi.dsi.fastutil.ints.IntSortedSet tailSet(int from)
tailSet in interface it.unimi.dsi.fastutil.ints.IntSortedSetpublic it.unimi.dsi.fastutil.ints.IntSortedSet subSet(int from,
int to)
subSet in interface it.unimi.dsi.fastutil.ints.IntSortedSetpublic int firstInt()
firstInt in interface it.unimi.dsi.fastutil.ints.IntSortedSetpublic int lastInt()
lastInt in interface it.unimi.dsi.fastutil.ints.IntSortedSetpublic String toString()
toString in class it.unimi.dsi.fastutil.ints.AbstractIntCollectionpublic int hashCode()
public boolean equals(Object o)
equals in interface Collection<Integer>equals in interface Set<Integer>equals in class it.unimi.dsi.fastutil.ints.AbstractIntSeto - 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.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.