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)
Rule
public void addFacts(NameValueReferableMap facts)
Rule
public void setFacts(NameValueReferableMap facts)
Rule
public void setCondition(java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> condition)
Rule
setCondition
in interface Rule<T,U>
condition
- the true or false condition implementation for the Rule.public void setRuleState(RuleState ruleState)
Rule
RuleState
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)
Rule
public void addAction(java.util.function.BiConsumer<NameValueReferableTypeConvertibleMap<T>,Result<U>> action)
Rule
public void addFactNameFilter(java.lang.String... factNames)
Rule
addFactNameFilter
in interface Rule<T,U>
factNames
- the names of the facts filtered (i.e. to be included)public NameValueReferableMap getFacts()
Rule
public java.util.function.Predicate<NameValueReferableTypeConvertibleMap<T>> getCondition()
Rule
getCondition
in interface Rule<T,U>
public RuleState getRuleState()
Rule
getRuleState
in interface Rule<T,U>
public java.util.List<java.lang.Object> getActions()
Rule
getActions
in interface Rule<T,U>
public boolean invoke()
Rule
public void setResult(Result<U> result)
Rule