Package io.deephaven.util.compare
Class LongComparisons
java.lang.Object
io.deephaven.util.compare.LongComparisons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(long lhs, long rhs) Compares two longs according to the following rules:QueryConstants.NULL_LONGis less than all otherlongvalues Otherwise, normallongcomparison logic is usedstatic booleaneq(long lhs, long rhs) Compare two longs for equality consistent withcompare(long, long); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).static booleangeq(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) >= 0.static booleangt(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) > 0.static inthashCode(long x) Returns a hash code for alongvalue consistent witheq(long, long); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).static booleanleq(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) <= 0.static booleanlt(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) < 0.
-
Constructor Details
-
LongComparisons
public LongComparisons()
-
-
Method Details
-
compare
public static int compare(long lhs, long rhs) Compares two longs according to the following rules:QueryConstants.NULL_LONGis less than all otherlongvalues- Otherwise, normal
longcomparison logic is used
- Parameters:
lhs- the first valuerhs- the second value- Returns:
- the value
0iflhsis equal torhs; a value less than0iflhsis less thanrhs; and a value greater than0iflhsis greater thanrhs
-
eq
public static boolean eq(long lhs, long rhs) Compare two longs for equality consistent withcompare(long, long); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).Logically equivalent to
compare(lhs, rhs) == 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueif the values are equal,falseotherwise
-
hashCode
public static int hashCode(long x) Returns a hash code for alongvalue consistent witheq(long, long); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).- Parameters:
x- the value to hash- Returns:
- a hash code value for a
longvalue
-
gt
public static boolean gt(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) > 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater thanrhs
-
lt
public static boolean lt(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) < 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less thanrhs
-
geq
public static boolean geq(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) >= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater than or equal torhs
-
leq
public static boolean leq(long lhs, long rhs) Logically equivalent tocompare(lhs, rhs) <= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less than or equal torhs
-