Package com.google.common.collect
Class DiscreteDomain.IntegerDomain
java.lang.Object
com.google.common.collect.DiscreteDomain<Integer>
com.google.common.collect.DiscreteDomain.IntegerDomain
- All Implemented Interfaces:
Serializable
- Enclosing class:
DiscreteDomain<C extends Comparable>
private static final class DiscreteDomain.IntegerDomain
extends DiscreteDomain<Integer>
implements Serializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DiscreteDomain.IntegerDomainprivate static final longFields inherited from class com.google.common.collect.DiscreteDomain
supportsFastOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns a signed value indicating how many nested invocations ofDiscreteDomain.next(C)(if positive) orDiscreteDomain.previous(C)(if negative) are needed to reachendstarting 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 typeCthat is greater thanvalue, ornullif none exists.(package private) IntegerReturns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.Returns the unique greatest value of typeCthat is less thanvalue, ornullif none exists.private ObjecttoString()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
-
IntegerDomain
IntegerDomain()
-
-
Method Details
-
next
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<Integer>- Parameters:
value- any value of typeC- Returns:
- the least value greater than
value, ornullifvalueismaxValue()
-
previous
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<Integer>- Parameters:
value- any value of typeC- Returns:
- the greatest value less than
value, ornullifvalueisminValue()
-
offset
Description copied from class:DiscreteDomainReturns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.- Overrides:
offsetin classDiscreteDomain<Integer>
-
distance
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<Integer>- Returns:
- the distance as described above, or
Long.MIN_VALUEorLong.MAX_VALUEif the distance is too small or too large, respectively.
-
minValue
Description copied from class:DiscreteDomainReturns 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:
minValuein classDiscreteDomain<Integer>- Returns:
- the minimum value of type
C; never null
-
maxValue
Description copied from class:DiscreteDomainReturns 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:
maxValuein classDiscreteDomain<Integer>- Returns:
- the maximum value of type
C; never null
-
readResolve
-
toString
-