Package io.deephaven.util.compare
Class ByteComparisons
java.lang.Object
io.deephaven.util.compare.ByteComparisons
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
compare
(byte lhs, byte rhs) Compares two bytes according to the following rules:QueryConstants.NULL_BYTE
is less than all otherbyte
values Otherwise, normalbyte
comparison logic is usedstatic 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)
.static boolean
geq
(byte lhs, byte rhs) Logically equivalent tocompare(lhs, rhs) >= 0
.static boolean
gt
(byte lhs, byte rhs) Logically equivalent tocompare(lhs, rhs) > 0
.static int
hashCode
(byte x) Returns a hash code for abyte
value consistent witheq(byte, byte)
; that is,eq(x, y) ⇒ hashCode(x) == hashCode(y)
.static boolean
leq
(byte lhs, byte rhs) Logically equivalent tocompare(lhs, rhs) <= 0
.static boolean
lt
(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_BYTE
is less than all otherbyte
values- Otherwise, normal
byte
comparison logic is used
- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
- the value
0
iflhs
is equal torhs
; a value less than0
iflhs
is less thanrhs
; and a value greater than0
iflhs
is 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:
true
if the values are equal,false
otherwise
-
hashCode
public static int hashCode(byte x) Returns a hash code for abyte
value 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
byte
value
-
gt
public static boolean gt(byte lhs, byte rhs) Logically equivalent tocompare(lhs, rhs) > 0
.- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
true
ifflhs
is 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:
true
ifflhs
is 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:
true
ifflhs
is 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:
true
ifflhs
is less than or equal torhs
-