| Constructor and Description |
|---|
GoldenRule(java.lang.Class<T> factType) |
| 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. |
public GoldenRule(java.lang.Class<T> factType)
public void addFacts(NameValueReferable... facts)
Rulepublic void addFacts(NameValueReferableMap facts)
Rulepublic void setFacts(NameValueReferableMap facts)
Rulepublic void setCondition(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
RulesetCondition in interface Rule<T,U>condition - the true or false condition implementation for the Rule.public void setRuleState(RuleState ruleState)
RuleRuleState for the Rule; determines whether the rule chain should continue or not.setRuleState in interface Rule<T,U>ruleState - the new RuleState to be setpublic void addAction(java.util.function.Consumer<NameValueReferableTypeConvertibleMap<T>> action)
Rulepublic void addAction(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
Rulepublic void addFactNameFilter(java.lang.String... factNames)
RuleaddFactNameFilter in interface Rule<T,U>factNames - the names of the facts filtered (i.e. to be included)public NameValueReferableMap getFacts()
Rulepublic java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> getCondition()
RulegetCondition in interface Rule<T,U>public RuleState getRuleState()
RulegetRuleState in interface Rule<T,U>public java.util.List<java.lang.Object> getActions()
RulegetActions in interface Rule<T,U>public boolean invoke()
Rulepublic void setResult(Result<U> result)
Rule