public class Goal extends Object
Modifier and Type | Field and Description |
---|---|
private RuleSet |
definitions |
private SimpleSentence |
goal |
private int |
nextDefinition |
Constructor and Description |
---|
Goal(Goal genericGoal,
SimpleSentence goal)
Constructor of the class
|
Goal(SimpleSentence goal,
RuleSet definitions)
Constructor of the class
|
Modifier and Type | Method and Description |
---|---|
void |
addDefinition(Rule rule)
Adds the specified rule-definition to the goal's definitions.
|
SimpleSentence |
getGoal()
Gets the predicate form of the goal.
|
String |
getName()
Gets the name of the goal.
|
Clause |
getNextDefinition()
Gets the next definition of the goal.
|
boolean |
hasNextDefinition()
Checks if the goal has a next definition.
|
void |
reset()
Resets the next rule to get.
|
String |
toString()
Returns the goal under the form of:
"{
goal :- def1.
|
void |
updateNextRule()
Updates the next rule to get.
|
private SimpleSentence goal
private RuleSet definitions
private int nextDefinition
public Goal(SimpleSentence goal, RuleSet definitions)
goal
- the predicate form of the goal.definitions
- the definitions of the goal.public Goal(Goal genericGoal, SimpleSentence goal)
genericGoal
- the generic representation of the goal.goal
- the actual form of the new goal.public String getName()
SimpleSentence
predicate.SimpleSentence
representing the goal.public SimpleSentence getGoal()
SimpleSentence
object representing the goal.public void addDefinition(Rule rule)
This method should be used only while creating the Goal
object.
rule
- the Rule
object representing the definition to add.public boolean hasNextDefinition()
public Clause getNextDefinition()
Clause
object representing the definition. If
there is no next definition, returns null
.public void updateNextRule()
For now the strategy is very simple: take the definitions in the order of declaration.
public void reset()
For now the strategy is very simple: restart from the beginning.
public String toString()
toString
in class Object
Object.toString()