public class ReactiveRuleSet extends Object
The reactive rules are stored as ReactiveRule in an List.
The constructor is private as you must not use it. Instead use the
getInstance() method to get the only object of the class (or to
create it).
| Modifier and Type | Field and Description |
|---|---|
private static ReactiveRuleSet |
instance |
(package private) List<ReactiveRule> |
reactiveRules |
| Modifier | Constructor and Description |
|---|---|
private |
ReactiveRuleSet(ReactiveRule... reactiveRules)
Constructor of the class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRule(ReactiveRule rule)
Adds the specified reactive rule.
|
List<SimpleSentence> |
fireRules(RuleSet ruleSet,
List<String> events)
Fires all the reactive rules it contains thanks to there own
fireRule() method. |
static ReactiveRuleSet |
getInstance()
This is the method to get an instance of the class.
|
String |
toString()
Returns the set in the form of:
"Reactive rules: [(conditions) -> goal, (conditions) -> goal, ...]".
|
List<ReactiveRule> reactiveRules
private static volatile ReactiveRuleSet instance
private ReactiveRuleSet(ReactiveRule... reactiveRules)
getInstance() instead.public static ReactiveRuleSet getInstance()
ReactiveRuleSet.getInstance()ReactiveRuleSet.public void addRule(ReactiveRule rule)
rule - the ReactiveRule object representing the reactive rule
to add.public List<SimpleSentence> fireRules(RuleSet ruleSet, List<String> events)
fireRule() method. It returns all
the goals in order to push them into the list of the goals to solve.ruleSet - the table of truth to which the conditions are submitted to be
checked.events - the events/actions that have been performed on the database
during this cycle.List object containing all the fired goals.public String toString()
toString in class ObjectObject.toString()