public class ReactiveRule extends Object implements PCExpression
Modifier and Type | Field and Description |
---|---|
private List<String> |
actions |
private Clause |
causes |
private SimpleSentence |
goal |
Constructor and Description |
---|
ReactiveRule(Clause conditions,
SimpleSentence goal)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
List<SimpleSentence> |
fireRule(RuleSet database)
Fires the goals of the rule.
|
List<String> |
getActions()
Gets the actions that are in the condition clause.
|
ReactiveRule |
replaceVariables(SubstitutionSet s)
Replaces all the variables in the reactive rule according to the
specified bindings.
|
ReactiveRule |
standardizeVariablesApart(Hashtable<Variable,Variable> newVars)
Standardizes the variables in order to be sure that there won't be any
variable clashes.
|
String |
toString()
Returns the reactive rule in the form of:
"(conditions) -> goal".
|
private Clause causes
private SimpleSentence goal
public ReactiveRule(Clause conditions, SimpleSentence goal)
conditions
- the conditions of the reactive rule. This is the left part of
the implication.goal
- the goal to fire if the conditions are true. This is the right
part of the implication.public List<String> getActions()
ArrayList
containing all the actions in the condition
clause.public List<SimpleSentence> fireRule(RuleSet database)
database
- the table of truth to which the conditions are submitted to be
checked.List
object containing all the goals created.public ReactiveRule replaceVariables(SubstitutionSet s)
This method is recursive over all PCExpression
implementations.
replaceVariables
in interface PCExpression
s
- the SubstitutionSet
that contains the bindings of the
variables so far.ReactiveRule
object representing the bound reactive
rule.PCExpression.replaceVariables(model.SubstitutionSet)
public ReactiveRule standardizeVariablesApart(Hashtable<Variable,Variable> newVars)
This method is recursive over all PCExpression
implementations.
standardizeVariablesApart
in interface PCExpression
newVars
- is a parameter to save over the recursion all the variable
replacements done so far.ReactiveRule
object representing the standardized
reactive rule.PCExpression.standardizeVariablesApart(java.util.Hashtable)
public String toString()
toString
in class Object
Object.toString()