public class Action extends Object
Modifier and Type | Field and Description |
---|---|
private SimpleSentence |
action |
private Clause |
conditions |
private Clause |
conflicts |
private List<Initiator> |
initiators |
private List<Terminator> |
terminators |
Constructor and Description |
---|
Action(SimpleSentence action,
List<Initiator> initiators,
List<Terminator> terminators,
Clause conditions,
Clause conflicts)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
actionsAllowed(SimpleSentence event,
RuleSet rulesAndEvents,
RuleSet rulesAndNextEvents)
Checks if the action can be performed.
|
List<SimpleSentence> |
fluentsToInitiate(SimpleSentence event,
RuleSet rules)
Gets all the fluents that will be initiated.
|
List<SimpleSentence> |
fluentsToTerminate(SimpleSentence event,
RuleSet rules)
Gets all the fluents that will be terminated.
|
String |
getName()
Gets the name of the action.
|
SimpleSentence |
getPredicate()
Gets the predicate representing the action.
|
String |
toString()
Returns the action under the form of:
"if (conditions + conflicts) actionName=[[initiators], [terminators]]"
|
private SimpleSentence action
private List<Terminator> terminators
private Clause conditions
private Clause conflicts
public Action(SimpleSentence action, List<Initiator> initiators, List<Terminator> terminators, Clause conditions, Clause conflicts)
action
- the SimpleSentence
object that is the generic
predicate representing the action.initiators
- the List
containing all the DPost declarations
that initiates fluents.terminators
- the List
containing all the DPost declarations
that terminates fluents.conditions
- the preconditions that must be satisfied before performing the
action.public String getName()
SimpleSentence
predicate.SimpleSentence
representing the action.public SimpleSentence getPredicate()
SimpleSentence
.SimpleSentence
object representing the action.public boolean actionsAllowed(SimpleSentence event, RuleSet rulesAndEvents, RuleSet rulesAndNextEvents)
The method gets every solution for the conditions of the action and
applies the bindings got to the generic SimpleSentence
.
event
- the bound action to test if it can be performed.rulesAndEvents
- the rules and the events to check the conditions.rulesAndNextEvents
- the rules and the next events so far to check the conflicts.public List<SimpleSentence> fluentsToInitiate(SimpleSentence event, RuleSet rules)
event
- the version of the action that is performed on the database.rules
- the set of rules to check the body of the initators.List
of the bound fluents according to the
parameter.public List<SimpleSentence> fluentsToTerminate(SimpleSentence event, RuleSet rules)
event
- the version of the action that is performed on the database.rules
- the set of rules to check the body of the terminators.List
of the bound fluents according to the
parameter.public String toString()
toString
in class Object
Object.toString()