Class 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
    • Constructor Summary

      Constructors 
      Constructor Description
      LongDomain()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long distance​(java.lang.Long start, java.lang.Long end)
      Returns a signed value indicating how many nested invocations of DiscreteDomain.next(C) (if positive) or DiscreteDomain.previous(C) (if negative) are needed to reach end starting from start.
      java.lang.Long maxValue()
      Returns the maximum value of type C, if it has one.
      java.lang.Long minValue()
      Returns the minimum value of type C, if it has one.
      java.lang.Long next​(java.lang.Long value)
      Returns the unique least value of type C that is greater than value, or null if none exists.
      (package private) java.lang.Long offset​(java.lang.Long origin, long distance)
      Returns, conceptually, "origin + distance", or equivalently, the result of calling DiscreteDomain.next(C) on origin distance times.
      java.lang.Long previous​(java.lang.Long value)
      Returns the unique greatest value of type C that is less than value, or null if none exists.
      private java.lang.Object readResolve()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LongDomain

        LongDomain()
    • Method Detail

      • next

        @CheckForNull
        public java.lang.Long next​(java.lang.Long value)
        Description copied from class: DiscreteDomain
        Returns the unique least value of type C that is greater than value, or null if none exists. Inverse operation to DiscreteDomain.previous(C).
        Specified by:
        next in class DiscreteDomain<java.lang.Long>
        Parameters:
        value - any value of type C
        Returns:
        the least value greater than value, or null if value is maxValue()
      • previous

        @CheckForNull
        public java.lang.Long previous​(java.lang.Long value)
        Description copied from class: DiscreteDomain
        Returns the unique greatest value of type C that is less than value, or null if none exists. Inverse operation to DiscreteDomain.next(C).
        Specified by:
        previous in class DiscreteDomain<java.lang.Long>
        Parameters:
        value - any value of type C
        Returns:
        the greatest value less than value, or null if value is minValue()
      • offset

        java.lang.Long offset​(java.lang.Long origin,
                              long distance)
        Description copied from class: DiscreteDomain
        Returns, conceptually, "origin + distance", or equivalently, the result of calling DiscreteDomain.next(C) on origin distance times.
        Overrides:
        offset in class DiscreteDomain<java.lang.Long>
      • distance

        public long distance​(java.lang.Long start,
                             java.lang.Long end)
        Description copied from class: DiscreteDomain
        Returns a signed value indicating how many nested invocations of DiscreteDomain.next(C) (if positive) or DiscreteDomain.previous(C) (if negative) are needed to reach end starting from start. For example, if end = next(next(next(start))), then distance(start, end) == 3 and distance(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 class DiscreteDomain<java.lang.Long>
        Returns:
        the distance as described above, or Long.MIN_VALUE or Long.MAX_VALUE if the distance is too small or too large, respectively.
      • minValue

        public java.lang.Long minValue()
        Description copied from class: DiscreteDomain
        Returns the minimum value of type C, if it has one. The minimum value is the unique value for which Comparable.compareTo(Object) never returns a positive value for any input of type C.

        The default implementation throws NoSuchElementException.

        Overrides:
        minValue in class DiscreteDomain<java.lang.Long>
        Returns:
        the minimum value of type C; never null
      • maxValue

        public java.lang.Long maxValue()
        Description copied from class: DiscreteDomain
        Returns the maximum value of type C, if it has one. The maximum value is the unique value for which Comparable.compareTo(Object) never returns a negative value for any input of type C.

        The default implementation throws NoSuchElementException.

        Overrides:
        maxValue in class DiscreteDomain<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:
        toString in class java.lang.Object