Package com.google.common.collect
Class DiscreteDomain.LongDomain
- All Implemented Interfaces:
Serializable
- Enclosing class:
DiscreteDomain<C extends Comparable>
private static final class DiscreteDomain.LongDomain
extends DiscreteDomain<Long>
implements Serializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DiscreteDomain.LongDomain
private static final long
Fields inherited from class com.google.common.collect.DiscreteDomain
supportsFastOffset
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns a signed value indicating how many nested invocations ofDiscreteDomain.next(C)
(if positive) orDiscreteDomain.previous(C)
(if negative) are needed to reachend
starting fromstart
.maxValue()
Returns the maximum value of typeC
, if it has one.minValue()
Returns the minimum value of typeC
, if it has one.Returns the unique least value of typeC
that is greater thanvalue
, ornull
if none exists.(package private) Long
Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)
onorigin
distance
times.Returns the unique greatest value of typeC
that is less thanvalue
, ornull
if none exists.private Object
toString()
Methods inherited from class com.google.common.collect.DiscreteDomain
bigIntegers, integers, longs
-
Field Details
-
INSTANCE
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
LongDomain
LongDomain()
-
-
Method Details
-
next
Description copied from class:DiscreteDomain
Returns the unique least value of typeC
that is greater thanvalue
, ornull
if none exists. Inverse operation toDiscreteDomain.previous(C)
.- Specified by:
next
in classDiscreteDomain<Long>
- Parameters:
value
- any value of typeC
- Returns:
- the least value greater than
value
, ornull
ifvalue
ismaxValue()
-
previous
Description copied from class:DiscreteDomain
Returns the unique greatest value of typeC
that is less thanvalue
, ornull
if none exists. Inverse operation toDiscreteDomain.next(C)
.- Specified by:
previous
in classDiscreteDomain<Long>
- Parameters:
value
- any value of typeC
- Returns:
- the greatest value less than
value
, ornull
ifvalue
isminValue()
-
offset
Description copied from class:DiscreteDomain
Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)
onorigin
distance
times.- Overrides:
offset
in classDiscreteDomain<Long>
-
distance
Description copied from class:DiscreteDomain
Returns a signed value indicating how many nested invocations ofDiscreteDomain.next(C)
(if positive) orDiscreteDomain.previous(C)
(if negative) are needed to reachend
starting fromstart
. For example, ifend = next(next(next(start)))
, thendistance(start, end) == 3
anddistance(end, start) == -3
. As well,distance(a, a)
is always zero.Note that this function is necessarily well-defined for any discrete type.
- Specified by:
distance
in classDiscreteDomain<Long>
- Returns:
- the distance as described above, or
Long.MIN_VALUE
orLong.MAX_VALUE
if the distance is too small or too large, respectively.
-
minValue
Description copied from class:DiscreteDomain
Returns the minimum value of typeC
, if it has one. The minimum value is the unique value for whichComparable.compareTo(Object)
never returns a positive value for any input of typeC
.The default implementation throws
NoSuchElementException
.- Overrides:
minValue
in classDiscreteDomain<Long>
- Returns:
- the minimum value of type
C
; never null
-
maxValue
Description copied from class:DiscreteDomain
Returns the maximum value of typeC
, if it has one. The maximum value is the unique value for whichComparable.compareTo(Object)
never returns a negative value for any input of typeC
.The default implementation throws
NoSuchElementException
.- Overrides:
maxValue
in classDiscreteDomain<Long>
- Returns:
- the maximum value of type
C
; never null
-
readResolve
-
toString
-