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
Condition
s are true
and if so - compute my outcomes.- Since:
- 0.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
check
(ComputationContext context) Checks if thisRule
is satisfied.boolean
Checks whether this rule is computed, i.e.boolean
Checks whether this rule is not satisfied (i.e.boolean
Checks whether this rule is satisfied (i.e.outcome()
Returns this rule outcomes.withCondition
(Condition condition) Adds aCondition
to this rule.withOutcome
(String outcome, String value) Adds an outcome to this rule.
-
Constructor Details
-
Rule
public Rule()
-
-
Method Details
-
withCondition
Adds aCondition
to this rule.- Parameters:
condition
- TheCondition
to 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 itsCondition
s 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 itsCondition
s resolved tofalse
).- Returns:
- True if the rule is dissatisfied.
-
isSatisfied
public boolean isSatisfied()Checks whether this rule is satisfied (i.e. all of itsCondition
s are computed and resolved totrue
).- Returns:
- True if the rule is satisfied.
-
check
Checks if thisRule
is satisfied.- Parameters:
context
- TheComputationContext
's instance.- Throws:
DecitaException
- If the rule'sCondition
s could not be resolved.
-
outcome
Returns this rule outcomes.- Returns:
- The simple dictionary, containing all this rule's outcomes.
-