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