Class LongValue

    • Field Detail

      • value

        protected final long value
        the long value
    • Constructor Detail

      • LongValue

        public LongValue​(long value)
        Constructor.
        Parameters:
        value - the long value
    • Method Detail

      • compareTo

        public final int compareTo​(LongValue that)
        Compares this Object to a given Object.
        Specified by:
        compareTo in interface Comparable<LongValue>
        Parameters:
        that - the Object to compare with
        Returns:
        0 if equal, -1 if less than the given Object's value, or 1 if greater than given Object's value
      • equals

        public final boolean equals​(Object that)
        Tests for equality.
        Overrides:
        equals in class Object
        Parameters:
        that - the Object to compare with
        Returns:
        true if this Object's value is equal to the given Object's value
      • greaterThan

        public final boolean greaterThan​(long value)
        Compares this LongValue with a primitive long value.
        Parameters:
        value - the long value to compare with
        Returns:
        true if this LongValue is greater than the given long value
      • greaterThanOrEqual

        public final boolean greaterThanOrEqual​(long value)
        Compares this LongValue with a primitive long value.
        Parameters:
        value - the long value to compare with
        Returns:
        true if this LongValue is greater than or equal to the given long value
      • greaterThan

        public final boolean greaterThan​(LongValue that)
        Compares this LongValue with another LongValue.
        Parameters:
        that - the LongValue to compare with
        Returns:
        true if this LongValue is greater than the given LongValue
      • greaterThanOrEqual

        public final boolean greaterThanOrEqual​(LongValue that)
        Compares this LongValue with another LongValue.
        Parameters:
        that - the LongValue to compare with
        Returns:
        true if this LongValue is greater than or equal to the given LongValue
      • hashCode

        public final int hashCode()
        Returns the hash code for this Object.
        Overrides:
        hashCode in class Object
        Returns:
        hash code for this Object
      • lessThan

        public final boolean lessThan​(long that)
        Compares this LongValue with a primitive long value.
        Parameters:
        that - the long value to compare with
        Returns:
        true if this LongValue is less than the given long value
      • lessThanOrEqual

        public final boolean lessThanOrEqual​(long that)
        Compares this LongValue with a primitive long value.
        Parameters:
        that - the long value to compare with
        Returns:
        true if this LongValue is less than or equal to the given long value
      • lessThan

        public final boolean lessThan​(LongValue that)
        Compares this LongValue with another LongValue.
        Parameters:
        that - the LongValue value to compare with
        Returns:
        true if this LongValue is less than the given LongValue
      • lessThanOrEqual

        public final boolean lessThanOrEqual​(LongValue that)
        Compares this LongValue with another LongValue.
        Parameters:
        that - the LongValue value to compare with
        Returns:
        true if this LongValue is less than or equal to the given LongValue
      • toString

        public String toString()
        Converts this LongValue to a String.
        Overrides:
        toString in class Object
        Returns:
        a String representation of this LongValue
      • min

        public static <T extends LongValue> T min​(T lhs,
                                                  T rhs)
        Returns the min of the two long values.
        Type Parameters:
        T -
        Parameters:
        lhs -
        rhs -
        Returns:
        min value
        Throws:
        IllegalArgumentException - if either argument is null
      • max

        public static <T extends LongValue> T max​(T lhs,
                                                  T rhs)
        Returns the max of the two long values.
        Type Parameters:
        T -
        Parameters:
        lhs -
        rhs -
        Returns:
        max value
        Throws:
        IllegalArgumentException - if either argument is null
      • maxNullSafe

        public static <T extends LongValue> T maxNullSafe​(T lhs,
                                                          T rhs)
        Null-safe version of max(T, T). Nulls are considered less then any concrete value.
        Type Parameters:
        T -
        Parameters:
        lhs -
        rhs -
        Returns:
        max of two values or null if they are both null