Pandora.LogicParser.Formula
Class Or

java.lang.Object
  extended by Pandora.LogicParser.Formula.Formula
      extended by Pandora.LogicParser.Formula.Or
All Implemented Interfaces:
java.io.Serializable

public class Or
extends Formula

The Or formula.
Extends abstract Formula class.

See Also:
Serialized Form

Constructor Summary
Or(Formula left, Formula right)
          Constructs an Or Formula.
 
Method Summary
 void addToSignature(PanSignature signature)
          This method adds the Atoms and Terms of this Formula to the passed PanSignature IF it is not already in the signature.
 boolean checkSub(Term x, Term y, Formula f)
          Returns true if the passed formula f can be reached by substituting th eoccurrences of Term x by Term y in this Formula.
 java.lang.String clashes(PanSignature signature)
          Returns a String containing an Error character if this Formula clashes with the passed PanSignature, Otherwise it will return an Empty String ""
An Or Formula clashes with a signature if any of its left or right sub-Formulae clashes with the signature.
 java.lang.String display()
          Returns the a String to display the Or formula.
 Formula getLeft()
          Returns the left side formula.
 int getPrecedence()
          Returns an integer representing the precedence of this formula according to binding conventions
 Formula getRight()
          Returns the right side formula.
 java.util.List<Term> getTerms()
          This method returns a list of all the Terms this Formula contain.
 Formula regenerate()
          Returns a copy of the Formula which can be saved as part of the copy made for the undo function.
 Formula s()
          Creates SVar to replace PVar in the formula where necessary.
 void setAtoms()
          Obtains the atoms in the formula and adds them to the list of atoms for the tree which contains this formula.
The list of atoms is found in Formula class.
 void setVars(Var v)
          This method adds Var v to the list of variables this formula is bound to.
 Formula subAll(Term x, Term y)
          Returns the Formula that is derived after substituting ALL the occurrences of Term x with Term y in this Formula.
 
Methods inherited from class Pandora.LogicParser.Formula.Formula
check, concatNoDup, getAtoms, getTuples, getVars, higher, isBracketed, map, setLeft, setRight, setTuples, showTuples, sub
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Or

public Or(Formula left,
          Formula right)
Constructs an Or Formula.

Parameters:
left - Formula of left side of conjunction
right - Formula of right side of conjunction
Method Detail

getLeft

public Formula getLeft()
Returns the left side formula.

Overrides:
getLeft in class Formula

getRight

public Formula getRight()
Returns the right side formula.

Overrides:
getRight in class Formula

display

public java.lang.String display()
Returns the a String to display the Or formula.

Specified by:
display in class Formula

setAtoms

public void setAtoms()
Obtains the atoms in the formula and adds them to the list of atoms for the tree which contains this formula.
The list of atoms is found in Formula class.

Specified by:
setAtoms in class Formula

checkSub

public boolean checkSub(Term x,
                        Term y,
                        Formula f)
Returns true if the passed formula f can be reached by substituting th eoccurrences of Term x by Term y in this Formula.

Specified by:
checkSub in class Formula
Parameters:
x - Term represents the Term to be substituted.
y - Term represents the Term to substitute Term x.
f - Formula represents the Formula to check if it can be reached after substitution.

subAll

public Formula subAll(Term x,
                      Term y)
Returns the Formula that is derived after substituting ALL the occurrences of Term x with Term y in this Formula.

Specified by:
subAll in class Formula
Parameters:
x - Term represents the Term to be substituted.
y - Term represents the Term to substitute Term x.

setVars

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

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

clashes

public java.lang.String clashes(PanSignature signature)
Returns a String containing an Error character if this Formula clashes with the passed PanSignature, Otherwise it will return an Empty String ""
An Or Formula clashes with a signature if any of its left or right sub-Formulae clashes with the signature.

Specified by:
clashes in class Formula
Parameters:
signature - PanSignature represents the PanSignature to be checked if this Formula clashes with.

addToSignature

public void addToSignature(PanSignature signature)
This method adds the Atoms and Terms of this Formula to the passed PanSignature IF it is not already in the signature.

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

getTerms

public java.util.List<Term> getTerms()
This method returns a list of all the Terms this Formula contain.

Specified by:
getTerms in class Formula

s

public Formula s()
Creates SVar to replace PVar in the formula where necessary. Used for Raptor.

Specified by:
s in class Formula

regenerate

public Formula regenerate()
Returns a copy of the Formula which can be saved as part of the copy made for the undo function.

Specified by:
regenerate in class Formula

getPrecedence

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

Specified by:
getPrecedence in class Formula