Package com.google.common.collect
Class DiscreteDomain<C extends Comparable>
java.lang.Object
com.google.common.collect.DiscreteDomain<C>
@GwtCompatible
@Beta
@Deprecated(since="2022-12-01")
public abstract class DiscreteDomain<C extends Comparable>
extends Object
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
A descriptor for a discrete
Comparable
domain such as all
Integer
instances. A discrete domain is one that supports the three basic
operations: next(C)
, previous(C)
and distance(C, C)
, according
to their specifications. The methods minValue()
and maxValue()
should also be overridden for bounded types.
A discrete domain always represents the entire set of values of its type; it cannot represent partial domains such as "prime integers" or "strings of length 5."
See the Guava User Guide section on
DiscreteDomain
.
- Since:
- 10.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic DiscreteDomain
<BigInteger> Deprecated.Returns the discrete domain for values of typeBigInteger
.abstract long
Deprecated.Returns a signed value indicating how many nested invocations ofnext(C)
(if positive) orprevious(C)
(if negative) are needed to reachend
starting fromstart
.static DiscreteDomain
<Integer> integers()
Deprecated.Returns the discrete domain for values of typeInteger
.static DiscreteDomain
<Long> longs()
Deprecated.Returns the discrete domain for values of typeLong
.maxValue()
Deprecated.Returns the maximum value of typeC
, if it has one.minValue()
Deprecated.Returns the minimum value of typeC
, if it has one.abstract C
Deprecated.Returns the unique least value of typeC
that is greater thanvalue
, ornull
if none exists.abstract C
Deprecated.Returns the unique greatest value of typeC
that is less thanvalue
, ornull
if none exists.
-
Method Details
-
integers
Deprecated.Returns the discrete domain for values of typeInteger
.- Since:
- 14.0 (since 10.0 as
DiscreteDomains.integers()
)
-
longs
Deprecated.Returns the discrete domain for values of typeLong
.- Since:
- 14.0 (since 10.0 as
DiscreteDomains.longs()
)
-
bigIntegers
Deprecated.Returns the discrete domain for values of typeBigInteger
.- Since:
- 15.0
-
next
Deprecated.Returns the unique least value of typeC
that is greater thanvalue
, ornull
if none exists. Inverse operation toprevious(C)
.- Parameters:
value
- any value of typeC
- Returns:
- the least value greater than
value
, ornull
ifvalue
ismaxValue()
-
previous
Deprecated.Returns the unique greatest value of typeC
that is less thanvalue
, ornull
if none exists. Inverse operation tonext(C)
.- Parameters:
value
- any value of typeC
- Returns:
- the greatest value less than
value
, ornull
ifvalue
isminValue()
-
distance
Deprecated.Returns a signed value indicating how many nested invocations ofnext(C)
(if positive) orprevious(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.
- Returns:
- the distance as described above, or
Long.MIN_VALUE
orLong.MAX_VALUE
if the distance is too small or too large, respectively.
-
minValue
Deprecated.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
.- Returns:
- the minimum value of type
C
; never null - Throws:
NoSuchElementException
- if the type has no (practical) minimum value; for example,BigInteger
-
maxValue
Deprecated.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
.- Returns:
- the maximum value of type
C
; never null - Throws:
NoSuchElementException
- if the type has no (practical) maximum value; for example,BigInteger
-