Modifier and Type | Field and Description |
---|---|
private boolean |
isMatched |
private List<Unifiable> |
terms |
Modifier | Constructor and Description |
---|---|
|
SimpleSentence(Constant predicateName,
Unifiable... args)
Constructor of the class.
|
private |
SimpleSentence(List<Unifiable> args)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
Gets the name of the simple sentence.
|
SimpleSentenceSolutionNode |
getSolver(RuleSet rules,
SubstitutionSet parentSolution,
AbstractSolutionNode parentNode)
Creates a solver which is a node in the tree proof.
|
Unifiable |
getTerm(int index)
Gets the term at the specified index.
|
boolean |
isMatched()
Checks whether the name of the simple sentence matches so far a rule in
the database.
|
int |
length()
Gets the length which is the number of parameters plus the name of the
simple sentence.
|
SimpleSentence |
replaceVariables(SubstitutionSet s)
Replaces all the variables in the simple sentence according to the
specified bindings.
|
SimpleSentence |
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 simple sentence under the form of:
"predicateName(parameter1, parameter2, ...)".
|
SubstitutionSet |
unify(Unifiable expr,
SubstitutionSet s)
Unifies the simple sentence with the specified
expr expression
given the bindings s . |
public SimpleSentence(Constant predicateName, Unifiable... args)
predicateName
- the Constant
representing the name of the predicate
that is represented.args
- the parameters of this predicate in an array or as independent
arguments.public SimpleSentenceSolutionNode getSolver(RuleSet rules, SubstitutionSet parentSolution, AbstractSolutionNode parentNode)
This function is recursive over all objects that can be proved and creates the tree of proof for a clause.
getSolver
in interface Clause
rules
- the RuleSet
object containing the rules of knowledge.parentSolution
- the solution known so far at the parent node.parentNode
- the parent node in the tree.Clause.getSolver(RuleSet, SubstitutionSet, AbstractSolutionNode)
public int length()
Constant
and
Variable
objects used to represent the simple sentence.public Unifiable getTerm(int index)
index
- the position of the parameter.public String getName()
getName
in interface Unifiable
Unifiable.getName()
public boolean isMatched()
public SimpleSentence 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.SimpleSentence
object representing the bound simple
sentence.PCExpression.replaceVariables(model.SubstitutionSet)
public SimpleSentence 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.SimpleSentence
object representing the standardized
simple sentence.PCExpression.standardizeVariablesApart(java.util.Hashtable)
public SubstitutionSet unify(Unifiable expr, SubstitutionSet s)
expr
expression
given the bindings s
. This tries to get or add bindings in order
to make logically equivalent the simple sentence and the specified
expression.
This method is recursive over all Unifiable
implementations.
unify
in interface Unifiable
expr
- an expression to unify with the simple sentence.s
- the SubstitutionSet
object representing the bindings
so far and/or the constraints applied.SubstitutionSet
object that contains all the bindings
needed to unify the simple sentence to the specified expression.Unifiable.unify(Unifiable, SubstitutionSet)
public String toString()
toString
in class Object
Object.toString()