Package com.google.common.collect
Class DiscreteDomain.BigIntegerDomain
- java.lang.Object
-
- com.google.common.collect.DiscreteDomain<java.math.BigInteger>
-
- com.google.common.collect.DiscreteDomain.BigIntegerDomain
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- DiscreteDomain<C extends java.lang.Comparable>
private static final class DiscreteDomain.BigIntegerDomain extends DiscreteDomain<java.math.BigInteger> implements java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description private static DiscreteDomain.BigIntegerDomain
INSTANCE
private static java.math.BigInteger
MAX_LONG
private static java.math.BigInteger
MIN_LONG
private static long
serialVersionUID
-
Fields inherited from class com.google.common.collect.DiscreteDomain
supportsFastOffset
-
-
Constructor Summary
Constructors Constructor Description BigIntegerDomain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
distance(java.math.BigInteger start, java.math.BigInteger end)
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
.java.math.BigInteger
next(java.math.BigInteger value)
Returns the unique least value of typeC
that is greater thanvalue
, ornull
if none exists.(package private) java.math.BigInteger
offset(java.math.BigInteger origin, long distance)
Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)
onorigin
distance
times.java.math.BigInteger
previous(java.math.BigInteger value)
Returns the unique greatest value of typeC
that is less thanvalue
, ornull
if none exists.private java.lang.Object
readResolve()
java.lang.String
toString()
-
Methods inherited from class com.google.common.collect.DiscreteDomain
bigIntegers, integers, longs, maxValue, minValue
-
-
-
-
Field Detail
-
INSTANCE
private static final DiscreteDomain.BigIntegerDomain INSTANCE
-
MIN_LONG
private static final java.math.BigInteger MIN_LONG
-
MAX_LONG
private static final java.math.BigInteger MAX_LONG
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
next
public java.math.BigInteger next(java.math.BigInteger value)
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<java.math.BigInteger>
- Parameters:
value
- any value of typeC
- Returns:
- the least value greater than
value
, ornull
ifvalue
ismaxValue()
-
previous
public java.math.BigInteger previous(java.math.BigInteger value)
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<java.math.BigInteger>
- Parameters:
value
- any value of typeC
- Returns:
- the greatest value less than
value
, ornull
ifvalue
isminValue()
-
offset
java.math.BigInteger offset(java.math.BigInteger origin, long distance)
Description copied from class:DiscreteDomain
Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)
onorigin
distance
times.- Overrides:
offset
in classDiscreteDomain<java.math.BigInteger>
-
distance
public long distance(java.math.BigInteger start, java.math.BigInteger end)
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<java.math.BigInteger>
- Returns:
- the distance as described above, or
Long.MIN_VALUE
orLong.MAX_VALUE
if the distance is too small or too large, respectively.
-
readResolve
private java.lang.Object readResolve()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-