Package com.google.common.collect
Class DiscreteDomain.LongDomain
- java.lang.Object
-
- com.google.common.collect.DiscreteDomain<java.lang.Long>
-
- com.google.common.collect.DiscreteDomain.LongDomain
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- DiscreteDomain<C extends java.lang.Comparable>
private static final class DiscreteDomain.LongDomain extends DiscreteDomain<java.lang.Long> implements java.io.Serializable
-
-
Field Summary
Fields Modifier and Type Field Description private static DiscreteDomain.LongDomainINSTANCEprivate static longserialVersionUID-
Fields inherited from class com.google.common.collect.DiscreteDomain
supportsFastOffset
-
-
Constructor Summary
Constructors Constructor Description LongDomain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longdistance(java.lang.Long start, java.lang.Long 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.lang.LongmaxValue()Returns the maximum value of typeC, if it has one.java.lang.LongminValue()Returns the minimum value of typeC, if it has one.java.lang.Longnext(java.lang.Long value)Returns the unique least value of typeCthat is greater thanvalue, ornullif none exists.(package private) java.lang.Longoffset(java.lang.Long origin, long distance)Returns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.java.lang.Longprevious(java.lang.Long 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
-
-
-
-
Field Detail
-
INSTANCE
private static final DiscreteDomain.LongDomain INSTANCE
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
next
public java.lang.Long next(java.lang.Long 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.lang.Long>- Parameters:
value- any value of typeC- Returns:
- the least value greater than
value, ornullifvalueismaxValue()
-
previous
public java.lang.Long previous(java.lang.Long 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.lang.Long>- Parameters:
value- any value of typeC- Returns:
- the greatest value less than
value, ornullifvalueisminValue()
-
offset
java.lang.Long offset(java.lang.Long origin, long distance)Description copied from class:DiscreteDomainReturns, conceptually, "origin + distance", or equivalently, the result of callingDiscreteDomain.next(C)onorigindistancetimes.- Overrides:
offsetin classDiscreteDomain<java.lang.Long>
-
distance
public long distance(java.lang.Long start, java.lang.Long 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.lang.Long>- Returns:
- the distance as described above, or
Long.MIN_VALUEorLong.MAX_VALUEif the distance is too small or too large, respectively.
-
minValue
public java.lang.Long 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<java.lang.Long>- Returns:
- the minimum value of type
C; never null
-
maxValue
public java.lang.Long 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<java.lang.Long>- Returns:
- the maximum value of type
C; never null
-
readResolve
private java.lang.Object readResolve()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-