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