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