Raptor.LogicParser.Formula.BExp
Class BExp

java.lang.Object
  extended by Raptor.LogicParser.Formula.Formula
      extended by Raptor.LogicParser.Formula.BExp.BExp
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EqualTo, GreaterThan, GTE, LessThan, LTE, NotEqual

public abstract class BExp
extends Formula

Abstract class for boolean expressions.

See Also:
Serialized Form

Field Summary
 Term left
           
 java.lang.String op
           
 Term right
           
 
Constructor Summary
BExp(Term pLeft, Term pRight, java.lang.String pOp)
          Create a new binary expression
 
Method Summary
 void addToSignature(PanSignature pSignature)
          This method adds this Formula to the passed PanSignature's Predicate list IF it is not already in the signature
If this Formula is an instance of Predicate, its Parameters will be added to the signature as well.
 boolean checkSub(Term pTermX, Term pTermY, Formula pFormula)
          Returns true if the passed formula f can be reached by substituting the occurrences of Term pTermX by Term pTermY.
 java.lang.String clashes(PanSignature pSignature)
          Returns a String of error message if this Term clashes with the passed PanSignature.
A Term clashes with a PanSignature if it clashes with any of its Predicates,Constants,Functions or Variables.
If this Term does not clash with the Signature, it is added to the signature and an empty String is returned.
abstract  java.lang.String display()
          Returns a String to display the BExp.
 Term getLeftTerm()
          Returns the left hand side of the boolean expression.
 int getPrecedence()
          Returns an integer representing the precedence of this formula according to binding conventions
 Term getRightTerm()
          Returns the right hand side of the boolean expression.
 java.util.List<Term> getTerms()
          Returns both left and right side of the boolean expression in a list of Terms.
 void setAtoms()
          Adds the list of Atoms in a given tree to the list of Atoms.
 void setVars(Var pVar)
          This method adds Var v to the list of variables this Formula is bound to.
 
Methods inherited from class Raptor.LogicParser.Formula.Formula
check, concatNoDup, getAtoms, getLeft, getRight, getTuples, getVars, higher, map, regenerate, s, setLeft, setRight, setTuples, showTuples, ST, sub, subAll, subAll, subBool, subBoolRes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

left

public Term left

right

public Term right

op

public java.lang.String op
Constructor Detail

BExp

public BExp(Term pLeft,
            Term pRight,
            java.lang.String pOp)
Create a new binary expression

Parameters:
pLeft - the left side of the binary expression
pRight - the right side of the binary expression
pOp - the operator of the binary expression
Method Detail

display

public abstract java.lang.String display()
Returns a String to display the BExp.

Specified by:
display in class Formula

getLeftTerm

public Term getLeftTerm()
Returns the left hand side of the boolean expression.


getRightTerm

public Term getRightTerm()
Returns the right hand side of the boolean expression.


checkSub

public boolean checkSub(Term pTermX,
                        Term pTermY,
                        Formula pFormula)
Returns true if the passed formula f can be reached by substituting the occurrences of Term pTermX by Term pTermY.

Specified by:
checkSub in class Formula
Parameters:
pTermX - Term represents the Term to be substituted.
pTermY - represents the Term to substitute Term pTermX.
pFormula - represents the Formula to check to see if it can be reached after substitution.

setAtoms

public void setAtoms()
Adds the list of Atoms in a given tree to the list of Atoms.

Specified by:
setAtoms in class Formula

clashes

public java.lang.String clashes(PanSignature pSignature)
Returns a String of error message if this Term clashes with the passed PanSignature.
A Term clashes with a PanSignature if it clashes with any of its Predicates,Constants,Functions or Variables.
If this Term does not clash with the Signature, it is added to the signature and an empty String is returned.

Specified by:
clashes in class Formula
Parameters:
pSignature - PanSignature Represents the signature to be compared against.

getTerms

public java.util.List<Term> getTerms()
Returns both left and right side of the boolean expression in a list of Terms.

Specified by:
getTerms in class Formula

addToSignature

public void addToSignature(PanSignature pSignature)
This method adds this Formula to the passed PanSignature's Predicate list IF it is not already in the signature
If this Formula is an instance of Predicate, its Parameters will be added to the signature as well.

Specified by:
addToSignature in class Formula
Parameters:
pSignature - PanSignature represents the signature to add this Formula to.

setVars

public void setVars(Var pVar)
This method adds Var v to the list of variables this Formula is bound to.

Specified by:
setVars in class Formula
Parameters:
pVar - Var represents the Var to be added to the list of this Formula's variables.

getPrecedence

public int getPrecedence()
Returns an integer representing the precedence of this formula according to binding conventions

Specified by:
getPrecedence in class Formula