/** * <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); }
@Override public boolean matches(@Nullable Property<?, ?> other) { return this.getOperator().compare(this, other); }
/** * Return the default operator to use, based on the supplied key and value. * * @param key Property key * @param value Property initial value, may be null * @return operator to use */ protected Operator getDefaultOperator(K key, @Nullable V value) { return Operator.defaultOperator(); }
/** * <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); }
@Override public boolean matches(@Nullable Property<?, ?> other) { return this.getOperator().compare(this, other); }
@Override public boolean matches(@Nullable Property<?, ?> other) { return this.getOperator().compare(this, other); }
@Override protected boolean apply(Property<?, ?> operand1, Property<?, ?> operand2) { return operand2.getOperator() != Operator.DELEGATE && operand2.getOperator().compare(operand1, operand2); } },
/** * Return the default operator to use, based on the supplied key and value. * * @param key Property key * @param value Property initial value, may be null * @return operator to use */ protected Operator getDefaultOperator(K key, @Nullable V value) { return Operator.defaultOperator(); }
/** * Return the default operator to use, based on the supplied key and value. * * @param key Property key * @param value Property initial value, may be null * @return operator to use */ protected Operator getDefaultOperator(K key, @Nullable V value) { return Operator.defaultOperator(); }
@Override public boolean matches(@Nullable Property<?, ?> other) { return this.getOperator().compare(this, other); }
/** * Return the default operator to use, based on the supplied key and value. * * @param key Property key * @param value Property initial value, may be null * @return operator to use */ protected Operator getDefaultOperator(K key, @Nullable V value) { return Operator.defaultOperator(); }
@Override protected boolean apply(Property<?, ?> operand1, Property<?, ?> operand2) { return operand2.getOperator() != Operator.DELEGATE && operand2.getOperator().compare(operand1, operand2); } },