Pandora.LogicParser.Formula
Class SimpleTerm

java.lang.Object
  extended by Pandora.LogicParser.Formula.Term
      extended by Pandora.LogicParser.Formula.SimpleTerm
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SimpleTerm
extends Term

The SimpleTerm (a Constant)
Extends abstract class Term.

See Also:
Serialized Form

Constructor Summary
SimpleTerm(java.lang.String name)
          Constructs a SimpleTerm(A constant)
 
Method Summary
 void addToSignature(PanSignature signature)
          This method adds this SimpleTerm to the Constant List of the passed PanSignature IF it is not already in the signature.
 boolean clashes(Atom a)
          Returns true if the passed Atom clashes with this SimpleTerm
An Atom clashes with a SimpleTerm if they have the same name.
 java.lang.String clashes(PanSignature signature)
          Returns a String of error message if this SimpleTerm clashes with the passed PanSignature
A SimpleTerm clashes with a PanSignature if it clashes with any of its Predicates,Constants,Functions or Variables.
If this SimpleTerm does not clash with the Signature, it is added to the Constant list of the signature and an empty String is returned.
 boolean clashes(Term t)
          Returns true if the passed Term(Constant/Function/Variable) clashes with this SimpleTerm
A SimpleTerm clashes with a Term if they have the same name.
 SimpleTerm clone()
          Returns a copy(clone) of this SimpleTerm.
 java.lang.String display()
          Returns a String to display the SimpleTerm.
 boolean equals(Term x)
          Returns true if the passed Term is equal to this SimpleTerm
A Term is equal to a SimpleTerm if it is a SimpleTerm and they have the same name.
 java.lang.String getName()
          Returns the name of the SimpleTerm.
 boolean isIn(PanSignature signature)
          Returns true if this SimpleTerm is in the Constant list of the passed PanSignature
 void setVars(Var v)
          This method adds Var v to the list of variables this SimpleTerm is bound to.
 Term sub(Term x, Term y)
          Substitutes all the occurences of Term x by Term y.
 
Methods inherited from class Pandora.LogicParser.Formula.Term
concatNoDup, getVars, isIn, isInVars
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTerm

public SimpleTerm(java.lang.String name)
Constructs a SimpleTerm(A constant)

Parameters:
name - String of the name fo the SimpleTerm.
Method Detail

getName

public java.lang.String getName()
Returns the name of the SimpleTerm.

Specified by:
getName in class Term

sub

public Term sub(Term x,
                Term y)
Substitutes all the occurences of Term x by Term y.

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

display

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

Specified by:
display in class Term

equals

public boolean equals(Term x)
Returns true if the passed Term is equal to this SimpleTerm
A Term is equal to a SimpleTerm if it is a SimpleTerm and they have the same name.

Overrides:
equals in class Term
Parameters:
t - Term represents the Term it is to be compared against.

isIn

public boolean isIn(PanSignature signature)
Returns true if this SimpleTerm is in the Constant list of the passed PanSignature

Specified by:
isIn in class Term
Parameters:
signature - PanSignature represents the signature it is to be searched in.

clone

public SimpleTerm clone()
Returns a copy(clone) of this SimpleTerm.

Specified by:
clone in class Term

clashes

public boolean clashes(Atom a)
Returns true if the passed Atom clashes with this SimpleTerm
An Atom clashes with a SimpleTerm if they have the same name.

Parameters:
a - Atom represents the Atom to be compared against.

clashes

public boolean clashes(Term t)
Returns true if the passed Term(Constant/Function/Variable) clashes with this SimpleTerm
A SimpleTerm clashes with a Term if they have the same name.

Parameters:
t - Term Represents the Term to be compared against.

clashes

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

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

setVars

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

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

addToSignature

public void addToSignature(PanSignature signature)
This method adds this SimpleTerm to the Constant List of the passed PanSignature IF it is not already in the signature.

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