Pandora.LogicParser.Formula
Class Num

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

public class Num
extends Term

Creates a number term.
Extends abstract class Term.

See Also:
Serialized Form

Constructor Summary
Num(int value)
          Constructs a new Num Term.
 
Method Summary
 void addToSignature(PanSignature signature)
          This method adds this Term to the passed PanSignature IF it is not already in the signature
I.e.
 java.lang.String clashes(PanSignature signature)
          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.
I.e.
 Term clone()
          Returns a copy(clone) of this Term.
 java.lang.String display()
          Returns a String to display the num term.
 boolean equals(Term a)
          Returns true if the passed Term is equal to this Term
 java.lang.String getName()
          Returns the name of the Term.
 boolean isIn(PanSignature signature)
          Returns true if this Term is in the passed PanSignature
I.e.
 void setVars(Var v)
          This method adds Var v to the list of variables this Term is bound to
 Term sub(Term a, Term b)
          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

Num

public Num(int value)
Constructs a new Num Term.

Parameters:
value - the numerical value of the num
Method Detail

display

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

Specified by:
display in class Term

sub

public Term sub(Term a,
                Term b)
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

equals

public boolean equals(Term a)
Returns true if the passed Term is equal to this Term

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

getName

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

Specified by:
getName in class Term

isIn

public boolean isIn(PanSignature signature)
Returns true if this Term is in the passed PanSignature
I.e. Returns false as Numbers are not part of the signature and are not stored in the signature.

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

clashes

public java.lang.String clashes(PanSignature signature)
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.
I.e. Returns an empty String as a number never clashes witha PanSignature.

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

clone

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

Specified by:
clone in class Term

addToSignature

public void addToSignature(PanSignature signature)
This method adds this Term to the passed PanSignature IF it is not already in the signature
I.e. As this term is a number it is NOT added to the signature.

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

setVars

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

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