Raptor.LogicParser.Formula
Class Function

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

public class Function
extends Term

The Function Term.
Extends abstract class Term.

See Also:
Serialized Form

Constructor Summary
Function(java.lang.String pName, java.util.Vector<Term> pParams)
          Constructs a Function Term.
 
Method Summary
 void addToSignature(PanSignature pSignature)
          This method adds this Function to the Function List and its Terms to the passed PanSignature IF it is not already in the signature.
 boolean clashes(Atom pAtom)
          Returns true if the passed Atom clashes with this Function
An Atom clashes with a Function if they have the same name.
 java.lang.String clashes(PanSignature pSignature)
          Returns a String of error message if this Function clashes with the passed PanSignature.
A Function clashes with a PanSignature if it clashes with any of its Predicates,Constants, Functions or Variables.
If this Function does not clash with the Signature, the Function is added to the Function list of the signature and an empty String is returned.
 boolean clashes(Term pTerm)
          Returns true if the passed Term(Constant/Function/Variable) clashes with this Function.
A Function clashes with a Term if they have the same name.
Two Functions clash if they have the same name but different arities.
 Function clone()
          Returns a copy (clone) of the Function.
 java.lang.String display()
          Returns the String to display the Function term.
 boolean equals(Term pTerm)
          Returns true if the passed Function is equal to this Function
Two Functions are equal if they have the same name,same arity and the same parameters in the same order.
 boolean equivalent(Function pFunction)
          Returns true if the passed Function is equal to this Function
Two Functions are equal if they have the same name,same arity and the same parameters in the same order.
 int getArity()
          Returns the arity of the Function.
 java.lang.String getName()
          Returns the name of the Function.
 java.util.Vector<Term> getParams()
          Returns the list of parameters of the Function.
 java.util.List<Term> getTerms()
          This method returns a list of all the Terms this Function contain.
 boolean isIn(PanSignature pSignature)
          Returns true if this Function is in the Function list of the passed PanSignature.
 boolean paramsEqual(Function pFunction)
          Returns true if the passed Function has the same parameters as this Function.
 Term regenerate()
          Returns a copy of Function to be saved in the undo record
 void setVars(Var pVar)
          This method adds Var v to the list of variables this Function is bound to.
 Term sub(Term pTermX, Term pTermY)
          Substitutes all the occurences of Term x by Term y.
 
Methods inherited from class Raptor.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

Function

public Function(java.lang.String pName,
                java.util.Vector<Term> pParams)
Constructs a Function Term.

Parameters:
pName - String of the name fo the function
Method Detail

getName

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

Specified by:
getName in class Term

getArity

public int getArity()
Returns the arity of the Function.


getParams

public java.util.Vector<Term> getParams()
Returns the list of parameters of the Function.


display

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

Specified by:
display in class Term

equals

public boolean equals(Term pTerm)
Returns true if the passed Function is equal to this Function
Two Functions are equal if they have the same name,same arity and the same parameters in the same order.

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

paramsEqual

public boolean paramsEqual(Function pFunction)
Returns true if the passed Function has the same parameters as this Function.

Parameters:
pFunction - Function represents the function which is to compare its parameters against.

sub

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

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

clone

public Function clone()
Returns a copy (clone) of the Function.

Specified by:
clone in class Term

clashes

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

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

clashes

public boolean clashes(Term pTerm)
Returns true if the passed Term(Constant/Function/Variable) clashes with this Function.
A Function clashes with a Term if they have the same name.
Two Functions clash if they have the same name but different arities.

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

clashes

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

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

equivalent

public boolean equivalent(Function pFunction)
Returns true if the passed Function is equal to this Function
Two Functions are equal if they have the same name,same arity and the same parameters in the same order.

Parameters:
pFunction - Function represents the Function it is to be compared against.

isIn

public boolean isIn(PanSignature pSignature)
Returns true if this Function is in the Function list of the passed PanSignature.

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

setVars

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

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

addToSignature

public void addToSignature(PanSignature pSignature)
This method adds this Function to the Function List and its Terms to the passed PanSignature IF it is not already in the signature.

Specified by:
addToSignature in class Term
Parameters:
pSignature - 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 Function contain.


regenerate

public Term regenerate()
Returns a copy of Function to be saved in the undo record