Package io.deephaven.util.compare
Class IntComparisons
java.lang.Object
io.deephaven.util.compare.IntComparisons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(int lhs, int rhs) Compares two ints according to the following rules:QueryConstants.NULL_INTis less than all otherintvalues Otherwise, normalintcomparison logic is usedstatic booleaneq(int lhs, int rhs) Compare two ints for equality consistent withcompare(int, int); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).static booleangeq(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) >= 0.static booleangt(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) > 0.static inthashCode(int x) Returns a hash code for aintvalue consistent witheq(int, int); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).static booleanleq(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) <= 0.static booleanlt(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) < 0.
-
Constructor Details
-
IntComparisons
public IntComparisons()
-
-
Method Details
-
compare
public static int compare(int lhs, int rhs) Compares two ints according to the following rules:QueryConstants.NULL_INTis less than all otherintvalues- Otherwise, normal
intcomparison 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(int lhs, int rhs) Compare two ints for equality consistent withcompare(int, int); 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(int x) Returns a hash code for aintvalue consistent witheq(int, int); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).- Parameters:
x- the value to hash- Returns:
- a hash code value for a
doublevalue
-
gt
public static boolean gt(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) > 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater thanrhs
-
lt
public static boolean lt(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) < 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less thanrhs
-
geq
public static boolean geq(int lhs, int 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(int lhs, int rhs) Logically equivalent tocompare(lhs, rhs) <= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less than or equal torhs
-