public class GoalsList extends Object
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).
solveGoals(RuleSet, RuleSet)
Modifier and Type | Field and Description |
---|---|
private GoalSet |
goalsDefinitions |
private Map<Goal,AbstractSolutionNode> |
goalsList |
private static GoalsList |
instance |
private RuleSet |
nextEvents |
Modifier | Constructor and Description |
---|---|
private |
GoalsList()
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
void |
addGoal(SimpleSentence goal,
RuleSet ruleSet)
Adds the specified goal to the list of goals.
|
void |
addNextEvent(SimpleSentence event)
Adds the specified event to the list of events that will be performed
during the next cycle.
|
private boolean |
backtrack(AbstractSolutionNode leaf,
Goal goal,
RuleSet rulesAndEvents,
RuleSet ruleSet,
RuleSet events) |
GoalSet |
getGoalsDefinitions()
Gets the goals definitions set.
|
static GoalsList |
getInstance()
This is the method to get an instance of the class.
|
void |
setGoalsDefinitions(GoalSet goalsDefinitions)
Sets the goals definitions set.
|
boolean |
solveGoal(Goal goal,
RuleSet ruleSet,
RuleSet events,
RuleSet rulesAndEvents)
Solves the specified goal.
|
void |
solveGoals(RuleSet ruleSet,
RuleSet events)
Solves all the goal in the list.
|
String |
toString()
Returns the set in the form of:
"{
[definitionChosen] => [currentNode]
}".
|
private RuleSet nextEvents
private GoalSet goalsDefinitions
private Map<Goal,AbstractSolutionNode> goalsList
private static volatile GoalsList instance
public static GoalsList getInstance()
Database.getInstance()
Database
.public void setGoalsDefinitions(GoalSet goalsDefinitions)
goalsDefinitions
- the set containing all the goals definitions.public GoalSet getGoalsDefinitions()
GoalSet
object containing all the goals definitions.public void addNextEvent(SimpleSentence event)
event
- the event to add.public void addGoal(SimpleSentence goal, RuleSet ruleSet)
goal
- the goal to add.ruleSet
- the rules to use to build the tree of proof.private boolean backtrack(AbstractSolutionNode leaf, Goal goal, RuleSet rulesAndEvents, RuleSet ruleSet, RuleSet events)
public boolean solveGoal(Goal goal, RuleSet ruleSet, RuleSet events, RuleSet rulesAndEvents)
goal
- the goal to solve.ruleSet
- the ruleSet to reset the tree with.events
- the events that have been used to update the database.public void solveGoals(RuleSet ruleSet, RuleSet events)
events
- the events that have been performed during the cycle.public String toString()
toString
in class Object
Object.toString()