private static final class DiscreteDomain.IntegerDomain extends DiscreteDomain<java.lang.Integer> implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
private static DiscreteDomain.IntegerDomain |
INSTANCE |
private static long |
serialVersionUID |
supportsFastOffset| Constructor and Description |
|---|
IntegerDomain() |
| Modifier and Type | Method and Description |
|---|---|
long |
distance(java.lang.Integer start,
java.lang.Integer end)
Returns a signed value indicating how many nested invocations of
DiscreteDomain.next(C) (if positive) or
DiscreteDomain.previous(C) (if negative) are needed to reach end starting from start. |
java.lang.Integer |
maxValue()
Returns the maximum value of type
C, if it has one. |
java.lang.Integer |
minValue()
Returns the minimum value of type
C, if it has one. |
java.lang.Integer |
next(java.lang.Integer value)
Returns the unique least value of type
C that is greater than value, or null if none exists. |
(package private) java.lang.Integer |
offset(java.lang.Integer origin,
long distance)
Returns, conceptually, "origin + distance", or equivalently, the result of calling
DiscreteDomain.next(C) on origin distance times. |
java.lang.Integer |
previous(java.lang.Integer value)
Returns the unique greatest value of type
C that is less than value, or null if none exists. |
private java.lang.Object |
readResolve() |
java.lang.String |
toString() |
bigIntegers, integers, longsprivate static final DiscreteDomain.IntegerDomain INSTANCE
private static final long serialVersionUID
public java.lang.Integer next(java.lang.Integer value)
DiscreteDomainC that is greater than value, or null if none exists. Inverse operation to DiscreteDomain.previous(C).next in class DiscreteDomain<java.lang.Integer>value - any value of type Cvalue, or null if value is maxValue()public java.lang.Integer previous(java.lang.Integer value)
DiscreteDomainC that is less than value, or null if none exists. Inverse operation to DiscreteDomain.next(C).previous in class DiscreteDomain<java.lang.Integer>value - any value of type Cvalue, or null if value is minValue()java.lang.Integer offset(java.lang.Integer origin,
long distance)
DiscreteDomainDiscreteDomain.next(C) on origin distance times.offset in class DiscreteDomain<java.lang.Integer>public long distance(java.lang.Integer start,
java.lang.Integer end)
DiscreteDomainDiscreteDomain.next(C) (if positive) or
DiscreteDomain.previous(C) (if negative) are needed to reach end starting from start.
For example, if end = next(next(next(start))), then distance(start, end) == 3
and distance(end, start) == -3. As well, distance(a, a) is always zero.
Note that this function is necessarily well-defined for any discrete type.
distance in class DiscreteDomain<java.lang.Integer>Long.MIN_VALUE or Long.MAX_VALUE if
the distance is too small or too large, respectively.public java.lang.Integer minValue()
DiscreteDomainC, if it has one. The minimum value is the unique
value for which Comparable.compareTo(Object) never returns a positive value for any
input of type C.
The default implementation throws NoSuchElementException.
minValue in class DiscreteDomain<java.lang.Integer>C; never nullpublic java.lang.Integer maxValue()
DiscreteDomainC, if it has one. The maximum value is the unique
value for which Comparable.compareTo(Object) never returns a negative value for any
input of type C.
The default implementation throws NoSuchElementException.
maxValue in class DiscreteDomain<java.lang.Integer>C; never nullprivate java.lang.Object readResolve()
public java.lang.String toString()
toString in class java.lang.Object