public interface Rule<T,U>
Modifier and Type | Method and Description |
---|---|
void |
addAction(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
Adds an action to the Rule to be invoked if the condition evaluates to true.
|
void |
addAction(java.util.function.Consumer<NameValueReferableTypeConvertibleMap<T>> action)
Adds an action to the Rule to be invoked if the condition evaluates to true.
|
void |
addFactNameFilter(java.lang.String... factNames)
Adds a filter to the facts by name.
|
void |
addFacts(NameValueReferable... facts)
Adds facts to a Rule.
|
void |
addFacts(NameValueReferableMap facts)
Adds facts to a Rule.
|
java.util.List<java.lang.Object> |
getActions()
Gets an ordered list of the actions added to the Rule.
|
java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> |
getCondition()
Gets the condition specified for the Rule.
|
NameValueReferableMap |
getFacts()
Gets the facts maintained in the Rule.
|
java.util.Optional<Result<U>> |
getResult()
Gets the Result of the Rule
|
RuleState |
getRuleState()
Gets the RuleState of the Rule.
|
boolean |
invoke()
Invokes the Rule.
|
void |
setCondition(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
Sets the condition for the Rule
|
void |
setFacts(NameValueReferableMap facts)
Sets the facts for a Rule.
|
void |
setResult(Result<U> result)
Sets the Result of the Rule.
|
void |
setRuleState(RuleState ruleState)
Sets the
RuleState for the Rule; determines whether the rule chain should continue or not. |
void addFacts(NameValueReferable... facts)
facts
- the facts to be added to the Rulevoid addFacts(NameValueReferableMap facts)
facts
- the map of facts to be added to the Rulevoid setFacts(NameValueReferableMap facts)
facts
- the map object to be used for facts in the Rulevoid setCondition(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
condition
- the true or false condition implementation for the Rule.void setRuleState(RuleState ruleState)
RuleState
for the Rule; determines whether the rule chain should continue or not.ruleState
- the new RuleState to be setvoid addAction(java.util.function.Consumer<NameValueReferableTypeConvertibleMap<T>> action)
action
- the specified action using factsvoid addAction(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
action
- the specified action using facts and a Resultvoid addFactNameFilter(java.lang.String... factNames)
factNames
- the names of the facts filtered (i.e. to be included)NameValueReferableMap getFacts()
java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> getCondition()
RuleState getRuleState()
java.util.List<java.lang.Object> getActions()
boolean invoke()
void setResult(Result<U> result)
result
- the Result of the Rule