Package ru.ewc.decita
Class Rule
java.lang.Object
ru.ewc.decita.Rule
I am a single Rule (i.e. the column in the decision table). My main responsibility is to check
whether all my second-order
Conditions are true and if so - compute my outcomes.- Since:
- 0.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck(ComputationContext context) Checks if thisRuleis satisfied.booleanChecks whether this rule is computed, i.e.booleanChecks whether this rule is not satisfied (i.e.booleanChecks whether this rule is satisfied (i.e.outcome()Returns this rule outcomes.withCondition(Condition condition) Adds aConditionto this rule.withOutcome(String outcome, String value) Adds an outcome to this rule.
-
Constructor Details
-
Rule
public Rule()
-
-
Method Details
-
withCondition
Adds aConditionto this rule.- Parameters:
condition- TheConditionto add.- Returns:
- Itself, in order to implement fluent API.
-
withOutcome
Adds an outcome to this rule.- Parameters:
outcome- The key of an outcome to add.value- The string representation of an outcome's value to add.- Returns:
- Itself, in order to implement fluent API.
-
isComputed
public boolean isComputed()Checks whether this rule is computed, i.e. all of itsConditions were resolved successfully.- Returns:
- True if the rule is computed.
-
isEliminated
public boolean isEliminated()Checks whether this rule is not satisfied (i.e. any of itsConditions resolved tofalse).- Returns:
- True if the rule is dissatisfied.
-
isSatisfied
public boolean isSatisfied()Checks whether this rule is satisfied (i.e. all of itsConditions are computed and resolved totrue).- Returns:
- True if the rule is satisfied.
-
check
Checks if thisRuleis satisfied.- Parameters:
context- TheComputationContext's instance.- Throws:
DecitaException- If the rule'sConditions could not be resolved.
-
outcome
Returns this rule outcomes.- Returns:
- The simple dictionary, containing all this rule's outcomes.
-