Class FWRuleSet
java.lang.Object
net.simplace.pipe.control.FWRuleSet
Ordered rules of the pipeline control, used by
RuleProcessor and
RuleFunctionality. Each rule is a JEXL expression or script with the same
syntax as the rules of a solution (${a.b} is the value of the parameter a.b):
<rule target="sim_work.multiple">${sim_work.simulationcount} gt 1</rule>
<rule target="sim_work.resultpage">
if (${sim_work.multiple}) { 'sim_work.form.result_simulation'; } else { 'sim_work.form.result_variable'; }
</rule>
The rule text is taken as it is (placeholders are not replaced before). The rules are evaluated in their order;
the result of a rule is set as parameter target, so later rules see the results of earlier ones.
Results of reserved targets (e.g. nextFunction of a switch point) are only returned. A rule that
cannot be evaluated or gives null is logged and sets nothing.- Author:
- Andreas Enders
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFWRuleSet(org.jdom2.Element aElement) Reads therulechildren of an element. -
Method Summary
Modifier and TypeMethodDescriptionevaluate(net.simplace.core.FWObservable aObservable) Evaluates the rules without reserved targets, seeevaluate(FWObservable, Collection).evaluate(net.simplace.core.FWObservable aObservable, Collection<String> aReservedTargets) Evaluates the rules in their order, see class description.booleanisEmpty()
-
Field Details
-
RULE
-
TARGET
-
-
Constructor Details
-
FWRuleSet
public FWRuleSet(org.jdom2.Element aElement) Reads therulechildren of an element. Rules without target or text are logged and skipped.- Parameters:
aElement- the element containing the rules, may benull
-
-
Method Details
-
isEmpty
public boolean isEmpty()- Returns:
trueif there are no rules
-
evaluate
public Map<String,Object> evaluate(net.simplace.core.FWObservable aObservable, Collection<String> aReservedTargets) Evaluates the rules in their order, see class description.- Parameters:
aObservable- the parameters; the results of all not reserved targets are set here (without notification)aReservedTargets- targets that are only returned, not set as parameter; may be empty- Returns:
- the results of all rules that gave a value, by target, in order of evaluation
-
evaluate
Evaluates the rules without reserved targets, seeevaluate(FWObservable, Collection).- Parameters:
aObservable- the parameters; the results are set here (without notification)- Returns:
- the results by target, in order of evaluation
-