Package io.deephaven.util.compare
Class CharComparisons
java.lang.Object
io.deephaven.util.compare.CharComparisons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(char lhs, char rhs) Compares two chars according to the following rules:QueryConstants.NULL_CHARis less than all othercharvalues Otherwise, normalcharcomparison logic is usedstatic booleaneq(char lhs, char rhs) Compare two chars for equality consistent withcompare(char, char); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).static booleangeq(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) >= 0.static booleangt(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) > 0.static inthashCode(char x) Returns a hash code for acharvalue consistent witheq(char, char); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).static booleanleq(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) <= 0.static booleanlt(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) < 0.
-
Constructor Details
-
CharComparisons
public CharComparisons()
-
-
Method Details
-
compare
public static int compare(char lhs, char rhs) Compares two chars according to the following rules:QueryConstants.NULL_CHARis less than all othercharvalues- Otherwise, normal
charcomparison logic is used
Note: this differs from the Java language numerical comparison operators
<, <=, >=, >andCharacter.compare(char, char).- 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(char lhs, char rhs) Compare two chars for equality consistent withcompare(char, char); 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(char x) Returns a hash code for acharvalue consistent witheq(char, char); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).- Parameters:
x- the value to hash- Returns:
- a hash code value for a
charvalue
-
gt
public static boolean gt(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) > 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater thanrhs
-
lt
public static boolean lt(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) < 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less thanrhs
-
geq
public static boolean geq(char lhs, char 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(char lhs, char rhs) Logically equivalent tocompare(lhs, rhs) <= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less than or equal torhs
-