protected static boolean booleanCompare(Object obj1, Object obj2, int compOp)
      throws TypeMismatchException {
    if (!(obj1 instanceof Boolean) || !(obj2 instanceof Boolean)) {
      throw new TypeMismatchException(
          "Booleans can only be compared with booleans");
    }

    if (compOp == TOK_EQ) {
      return obj1.equals(obj2);
    } else if (compOp == TOK_NE) {
      return !obj1.equals(obj2);
    } else {
      throw new TypeMismatchException(
          "Boolean values can only be compared with = or <>");
    }
  }
Compare two booleans.

@return a boolean indicating the result of applying the comparison operator on the arguments.
@throws TypeMismatchException When either one of the arguments is not a Boolean, or the
        comparison operator is not supported.
geode-core/src/main/java/org/apache/geode/cache/query/internal/types/TypeUtils.java