formulaVisited
Class VisitorEvaluate

java.lang.Object
  extended by formulaVisited.VisitorEvaluate
All Implemented Interfaces:
Visitor

public class VisitorEvaluate
extends java.lang.Object
implements Visitor

A visitor that evaluates each formula, returning Boolean.TRUE if the formula is true, Boolean.FALSE if the formula is false, and null if its value cannot be determined. The presence of undefined logical values, or predicates whoses value is not defined for every domain entity, can result in formulas whose logical values that cannot be determined.


Constructor Summary
VisitorEvaluate(Environment _env)
          Construct a VisitorEvaluate that evaluates formulas in the given environment.
 
Method Summary
 java.lang.Object visit(Conjunction _f)
          Calculates the result for a Conjunction. A conjunction is true if both its subformulas are true, false if either of its subformulas is false, and unknown otherwise.
 java.lang.Object visit(Disjunction _f)
          Calculates the result for a Disjunction. A disjunction is false if both its subformulas are false, true if either of its subformulas is true, and unknown otherwise.
 java.lang.Object visit(LogicalConstant _f)
          Calculates the result for a LogicalConstant. The value of LogicalConstant.one() is true, and the value of LogicalConstant.zero() is false.
 java.lang.Object visit(LogicalVariable _f)
          Calculates the result for a LogicalVariable. The value of a logical variable is the value the variable is bound to in the environment, and unknown if the variable is bound to no value.
 java.lang.Object visit(Negation _f)
          Calculates the result for a Negation. A negation is false if its subformula is true, false if its subformula is true, and unknown if its subformula's value is unknown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisitorEvaluate

public VisitorEvaluate(Environment _env)
Construct a VisitorEvaluate that evaluates formulas in the given environment.

Parameters:
_env - The environment.
Method Detail

visit

public java.lang.Object visit(Conjunction _f)
Calculates the result for a Conjunction. A conjunction is true if both its subformulas are true, false if either of its subformulas is false, and unknown otherwise.

Specified by:
visit in interface Visitor

visit

public java.lang.Object visit(Disjunction _f)
Calculates the result for a Disjunction. A disjunction is false if both its subformulas are false, true if either of its subformulas is true, and unknown otherwise.

Specified by:
visit in interface Visitor

visit

public java.lang.Object visit(LogicalConstant _f)
Calculates the result for a LogicalConstant. The value of LogicalConstant.one() is true, and the value of LogicalConstant.zero() is false.

Specified by:
visit in interface Visitor

visit

public java.lang.Object visit(LogicalVariable _f)
Calculates the result for a LogicalVariable. The value of a logical variable is the value the variable is bound to in the environment, and unknown if the variable is bound to no value. The environment used is the one with which this visitor was constructed.

Specified by:
visit in interface Visitor

visit

public java.lang.Object visit(Negation _f)
Calculates the result for a Negation. A negation is false if its subformula is true, false if its subformula is true, and unknown if its subformula's value is unknown.

Specified by:
visit in interface Visitor