public class Arithmetic extends Object implements Clause
Clause
.
Arithmetic expressions are only comparisons between numbers. Their operands must be bound before evaluation.
Modifier and Type | Field and Description |
---|---|
private Unifiable |
operand1 |
private Unifiable |
operand2 |
private String |
symbol |
Constructor and Description |
---|
Arithmetic(Unifiable operand1,
String symbol,
Unifiable operand2)
Constructor of the class
|
Modifier and Type | Method and Description |
---|---|
Unifiable |
getOperand1()
Gets the left operand of the arithmetic expression.
|
Unifiable |
getOperand2()
Gets the right operand of the arithmetic expression.
|
ArithmeticSolutionNode |
getSolver(RuleSet rules,
SubstitutionSet parentSolution,
AbstractSolutionNode parentNode)
Creates a solver which is a node in the tree proof.
|
String |
getSymbol()
Gets the symbol of the arithmetic expression.
|
Arithmetic |
replaceVariables(SubstitutionSet s)
Replaces all the variables in the arithmetic expression according to the
specified bindings.
|
Arithmetic |
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 arithmetic expression under the form of:
"operand1 'symbol' operand2".
|
private Unifiable operand1
private Unifiable operand2
private String symbol
public Unifiable getOperand1()
public Unifiable getOperand2()
public String getSymbol()
public ArithmeticSolutionNode 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.Clause.getSolver(RuleSet, SubstitutionSet, AbstractSolutionNode)
public Arithmetic 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.Arithmetic
object representing the bound arithmetic
expression.PCExpression.replaceVariables(model.SubstitutionSet)
public Arithmetic 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.Arithmetic
object representing the standardized
arithmetic expression.PCExpression.standardizeVariablesApart(java.util.Hashtable)
public String toString()
toString
in class Object
Object.toString()