| java.lang.Object org.ofbiz.rules.engine.Structure org.ofbiz.rules.engine.Gateway org.ofbiz.rules.engine.Evaluation
Evaluation | public class Evaluation extends Gateway (Code) | | An Evaluation unifies a term with the value of another term.
For example,
NumberFact two = new NumberFact(2);
ArithmeticOperator x, y;
x = new ArithmeticOperator('*', two, two);
y = new ArithmeticOperator('+', x, two);
Variable result = new Variable("Result");
Evaluation e = new Evaluation(result, y);
System.out.println(e);
System.out.println(e.canFindNextProof());
System.out.println(result);
prints out:
#(Result, +(*(2.0, 2.0), 2.0))
true
6.0
Since an Evaluation unifies the first term with the
arithmetic value, the second term may have a value before
the Evaluation proves itself. In this case, the Evaluation
checks that the second term's ground value equals the
arithmetic value of the first term.
The Evaluation fails if the arithmetic value is invalid for
any reason.
author: Steven J. Metsker version: 1.0 |
Constructor Summary | |
public | Evaluation(Term term0, Term term1) Constructs an Evaluation that will unify the first term
with the second term during proofs. |
Method Summary | |
public boolean | canProveOnce() Returns true if this Evaluation can unify its first term
with the value of its second term. | protected void | cleanup() The superclass calls this after the evaluation has
succeeded once, and rule is now failing backwards. | public Term | copyForProof(AxiomSource ignored, Scope scope) Create a copy that uses the provided scope. | public void | unbind() Releases the variable bindings that the last unification produced. |
Evaluation | public Evaluation(Term term0, Term term1)(Code) | | Constructs an Evaluation that will unify the first term
with the second term during proofs.
Parameters: Term - the first term to unify Parameters: Term - the term whose value should unifywith the first term |
canProveOnce | public boolean canProveOnce()(Code) | | Returns true if this Evaluation can unify its first term
with the value of its second term.
If the attempt to evaluate the second term causes an
exception, this method swallows it and simply fails.
true< , if this Evaluation can unifyits first term with the arithmetic value of itssecond term |
cleanup | protected void cleanup()(Code) | | The superclass calls this after the evaluation has
succeeded once, and rule is now failing backwards. The
assigment needs to undo any binding it did on the way
forward.
|
copyForProof | public Term copyForProof(AxiomSource ignored, Scope scope)(Code) | | Create a copy that uses the provided scope.
Parameters: AxiomSource - ignored Parameters: Scope - the scope to use for variables in thecopy a copy that uses the provided scope |
unbind | public void unbind()(Code) | | Releases the variable bindings that the last unification produced.
|
Fields inherited from org.ofbiz.rules.engine.Gateway | protected boolean open(Code)(Java Doc)
|
|
|