public abstract class AbstractSolutionNode extends Object
Modifier and Type | Field and Description |
---|---|
private Clause |
clause |
private Rule |
currentRule |
private AbstractSolutionNode |
deepestLeaf |
static int |
nodesCreated |
private AbstractSolutionNode |
parentNode |
private SubstitutionSet |
parentSolution |
private int |
ruleNumber |
private RuleSet |
rules |
Constructor and Description |
---|
AbstractSolutionNode(Clause clause,
RuleSet rules,
SubstitutionSet parentSolution,
AbstractSolutionNode parentNode)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
int |
currentRuleCount()
Gets the number of the current rule.
|
Clause |
getClause()
Gets the clause to prove in the context rules.
|
Rule |
getCurrentRule()
Gets the rule on which the node is currently working.
|
AbstractSolutionNode |
getDeepestLeaf()
Gets the deepest leaf of the tree.
|
AbstractSolutionNode |
getParentNode()
Gets the parent node.
|
SubstitutionSet |
getParentSolution()
Gets the parent solution.
|
RuleSet |
getRuleSet()
Gets the context rules of the tree.
|
boolean |
hasNextRule()
Checks if there is another rule in the context rules.
|
Rule |
nextRule()
Gets the next rule to work with.
|
abstract SubstitutionSet |
nextSolution()
Creates the next solution for the clause of the node.
|
protected void |
reset(SubstitutionSet newParentSolution,
RuleSet newRuleSet)
Resets the subtree to the new state of the database and resets all the
counters that prevent from infinite evaluation of the node.
|
void |
setDeepestLeaf(AbstractSolutionNode leaf)
Sets the deepest leaf to the specified leaf.
|
private RuleSet rules
private Rule currentRule
private Clause clause
private AbstractSolutionNode deepestLeaf
public static int nodesCreated
private SubstitutionSet parentSolution
private AbstractSolutionNode parentNode
private int ruleNumber
public AbstractSolutionNode(Clause clause, RuleSet rules, SubstitutionSet parentSolution, AbstractSolutionNode parentNode)
clause
- the clause to be proved by this subtree.rules
- the rules representing context of the proof.parentSolution
- the solution of the parent node in the tree of proof.public abstract SubstitutionSet nextSolution()
null
if there no other different solution.SubstitutionSet
object representing the bindings of the
next solution or null
if there is no next solution.protected void reset(SubstitutionSet newParentSolution, RuleSet newRuleSet)
newParentSolution
- the new parent solution of the subtree.newRuleSet
- the new state of the database.AndSolutionNode.reset(model.SubstitutionSet, model.RuleSet)
,
ArithmeticSolutionNode.reset(model.SubstitutionSet,
model.RuleSet)
,
NotSolutionNode.reset(model.SubstitutionSet, model.RuleSet)
,
SimpleSentenceSolutionNode.reset(model.SubstitutionSet,
model.RuleSet)
public int currentRuleCount()
public boolean hasNextRule()
public Rule nextRule()
Rule
object representing the next rule.public SubstitutionSet getParentSolution()
SubstitutionSet
object that represents the parent
solution.public AbstractSolutionNode getParentNode()
AbstractSolutionNode
object that represents the parent
node.public RuleSet getRuleSet()
RuleSet
object containing the context rules.public Rule getCurrentRule()
Rule
object representing the current rule.public Clause getClause()
Clause
object representing the clause to prove.public void setDeepestLeaf(AbstractSolutionNode leaf)
leaf
- the deepest leaf of the tree (the one that failed).public AbstractSolutionNode getDeepestLeaf()
AbstractSolutionNode
object representing the deepest
leaf of the tree.