Package ru.ewc.decita.conditions
Class BinaryCondition
java.lang.Object
ru.ewc.decita.conditions.BinaryCondition
- All Implemented Interfaces:
Condition
- Direct Known Subclasses:
EqualsCondition,GreaterThanCondition,LessThanCondition
I represent a simple
Condition using two Coordinates and some comparison
operation. My main responsibility is to compute that comparison and check if it's true or not.- Since:
- 0.1
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBinaryCondition(Coordinate left, Coordinate right) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.hamcrest.Matcher<Coordinate>Creates aMatcherthat corresponds to the given operation andCoordinate.final booleanevaluate(ComputationContext context) Evaluates all the parts of theConditionand provides the result of that evaluation.final booleanChecks if all the parts of the Condition are resolved and point to the constant values.final booleanChecks if thisConditionresolves totrue.protected final CoordinateReturns the right part of thisCondition.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ru.ewc.decita.conditions.Condition
isNotSatisfied
-
Constructor Details
-
BinaryCondition
Constructor.- Parameters:
left- Left-sideCoordinate.right- Right-sideCoordinate.
-
-
Method Details
-
evaluate
Description copied from interface:ConditionEvaluates all the parts of theConditionand provides the result of that evaluation.- Specified by:
evaluatein interfaceCondition- Parameters:
context- TheComputationContextto evaluateConditionin.- Returns:
- Whether the
Conditionstands true. - Throws:
DecitaException- If the evaluation cannot be performed.
-
isEvaluated
public final boolean isEvaluated()Description copied from interface:ConditionChecks if all the parts of the Condition are resolved and point to the constant values.- Specified by:
isEvaluatedin interfaceCondition- Returns:
- True, if both parts of the Condition are evaluated.
-
isSatisfied
public final boolean isSatisfied()Description copied from interface:ConditionChecks if thisConditionresolves totrue.- Specified by:
isSatisfiedin interfaceCondition- Returns:
- True, if it does.
-
comparisonFor
Creates aMatcherthat corresponds to the given operation andCoordinate.- Returns:
- The
Matcherto use in thisCondition.
-
rightPart
Returns the right part of thisCondition.- Returns:
- The
Coordinatethat is its right part.
-