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.BigIntegerDomainINSTANCEprivate static java.math.BigIntegerMAX_LONGprivate static java.math.BigIntegerMIN_LONGprivate static longserialVersionUID-
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 longdistance(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 reachendstarting fromstart.java.math.BigIntegernext(java.math.BigInteger value)Returns the unique least value of typeCthat is greater thanvalue, ornullif none exists.(package private) java.math.BigIntegeroffset(java.math.BigInteger origin, long distance)Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.java.math.BigIntegerprevious(java.math.BigInteger value)Returns the unique greatest value of typeCthat is less thanvalue, ornullif none exists.private java.lang.ObjectreadResolve()java.lang.StringtoString()-
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:DiscreteDomainReturns the unique least value of typeCthat is greater thanvalue, ornullif none exists. Inverse operation toDiscreteDomain.previous(C).- Specified by:
nextin classDiscreteDomain<java.math.BigInteger>- Parameters:
value- any value of typeC- Returns:
- the least value greater than
value, ornullifvalueismaxValue()
-
previous
public java.math.BigInteger previous(java.math.BigInteger value)
Description copied from class:DiscreteDomainReturns the unique greatest value of typeCthat is less thanvalue, ornullif none exists. Inverse operation toDiscreteDomain.next(C).- Specified by:
previousin classDiscreteDomain<java.math.BigInteger>- Parameters:
value- any value of typeC- Returns:
- the greatest value less than
value, ornullifvalueisminValue()
-
offset
java.math.BigInteger offset(java.math.BigInteger origin, long distance)Description copied from class:DiscreteDomainReturns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.- Overrides:
offsetin classDiscreteDomain<java.math.BigInteger>
-
distance
public long distance(java.math.BigInteger start, java.math.BigInteger end)Description copied from class:DiscreteDomainReturns a signed value indicating how many nested invocations ofDiscreteDomain.next(C)(if positive) orDiscreteDomain.previous(C)(if negative) are needed to reachendstarting fromstart. For example, ifend = next(next(next(start))), thendistance(start, end) == 3anddistance(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:
distancein classDiscreteDomain<java.math.BigInteger>- Returns:
- the distance as described above, or
Long.MIN_VALUEorLong.MAX_VALUEif the distance is too small or too large, respectively.
-
readResolve
private java.lang.Object readResolve()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-