/** * <p>Compare the two operands by applying this operator <em>infix</em> * with respect to them. For example, if this object is * {@link Operator#GREATER} then calling this method with * <code>object1</code> and <code>object2</code> would effectively * return:</p> * * <blockquote> <code>returnValue = object1 > object2;</code> * </blockquote> * * @param operand1 First operand * @param operand2 Second operand * @return First operand's comparison to second */ public final boolean compare(@Nullable Property<?, ?> operand1, @Nullable Property<?, ?> operand2) { if (this == Operator.EQUAL && operand1 == operand2) { // also catches both operands being null, which is okay, since // null.equals(null) -> true as far as we're concerned return true; } if (operand1 == null || operand2 == null) { return false; } return this.apply(operand1, operand2); }
/** * <p>Compare the two operands by applying this operator <em>infix</em> * with respect to them. For example, if this object is * {@link Operator#GREATER} then calling this method with * <code>object1</code> and <code>object2</code> would effectively * return:</p> * * <blockquote> <code>returnValue = object1 > object2;</code> * </blockquote> * * @param operand1 First operand * @param operand2 Second operand * @return First operand's comparison to second */ public final boolean compare(@Nullable Property<?, ?> operand1, @Nullable Property<?, ?> operand2) { if (this == Operator.EQUAL && operand1 == operand2) { // also catches both operands being null, which is okay, since // null.equals(null) -> true as far as we're concerned return true; } if (operand1 == null || operand2 == null) { return false; } return this.apply(operand1, operand2); }