private static final class DiscreteDomain.LongDomain extends DiscreteDomain<java.lang.Long> implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private static DiscreteDomain.LongDomain |
INSTANCE |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
LongDomain() |
Modifier and Type | Method and Description |
---|---|
long |
distance(java.lang.Long start,
java.lang.Long 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.Long |
maxValue()
Returns the maximum value of type
C , if it has one. |
java.lang.Long |
minValue()
Returns the minimum value of type
C , if it has one. |
java.lang.Long |
next(java.lang.Long value)
Returns the unique least value of type
C that is greater than
value , or null if none exists. |
java.lang.Long |
previous(java.lang.Long 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, longs
private static final DiscreteDomain.LongDomain INSTANCE
private static final long serialVersionUID
public java.lang.Long next(java.lang.Long value)
DiscreteDomain
C
that is greater than
value
, or null
if none exists. Inverse operation to DiscreteDomain.previous(C)
.next
in class DiscreteDomain<java.lang.Long>
value
- any value of type C
value
, or null
if
value
is maxValue()
public java.lang.Long previous(java.lang.Long value)
DiscreteDomain
C
that is less than
value
, or null
if none exists. Inverse operation to DiscreteDomain.next(C)
.previous
in class DiscreteDomain<java.lang.Long>
value
- any value of type C
value
, or null
if
value
is minValue()
public long distance(java.lang.Long start, java.lang.Long end)
DiscreteDomain
DiscreteDomain.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.Long>
Long.MIN_VALUE
or
Long.MAX_VALUE
if the distance is too small or too large,
respectively.public java.lang.Long minValue()
DiscreteDomain
C
, 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.Long>
C
; never nullpublic java.lang.Long maxValue()
DiscreteDomain
C
, 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.Long>
C
; never nullprivate java.lang.Object readResolve()
public java.lang.String toString()
toString
in class java.lang.Object