org.rubato.logeo.functions
Class AbstractFunction

java.lang.Object
  extended by org.rubato.logeo.functions.AbstractFunction
All Implemented Interfaces:
Function
Direct Known Subclasses:
CompositeFunction, IntegerFunction, ModuleMorphismFunction, RealFunction

public abstract class AbstractFunction
extends java.lang.Object
implements Function

This class implements functions on denotators. Functions may have any arity. The signature of function is indicated by implementing the getInputForm and getOutputForm methods.

Author:
Gérard Milmeister

Constructor Summary
AbstractFunction()
           
 
Method Summary
 Function compose(Function f)
          Returns a new function, the composition of this and f, i.e., this(f(x)).
abstract  Denotator evaluate(Denotator... denotators)
          Evaluates the function with a list of arguments.
abstract  int getArity()
          Returns the arity of the function.
abstract  Form getInputForm(int i)
          Returns the ith argument form.
 java.lang.String getName()
          Returns the name of the function.
abstract  Form getOutputForm()
          Returns the result form.
 boolean hasSig(Form[] inputForms, Form outputForm)
          Checks if the function has the given signature.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractFunction

public AbstractFunction()
Method Detail

evaluate

public abstract Denotator evaluate(Denotator... denotators)
                            throws RubatoException
Evaluates the function with a list of arguments.

Specified by:
evaluate in interface Function
Throws:
RubatoException

getArity

public abstract int getArity()
Returns the arity of the function. Must be implemented in a subclass.

Specified by:
getArity in interface Function

compose

public Function compose(Function f)
                 throws RubatoException
Returns a new function, the composition of this and f, i.e., this(f(x)).

Specified by:
compose in interface Function
Throws:
RubatoException - is composition fails

getName

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

Specified by:
getName in interface Function
Returns:
"anonymous" by default.

getInputForm

public abstract Form getInputForm(int i)
Returns the ith argument form. Must be implemented in a subclass.

Specified by:
getInputForm in interface Function
Returns:
null if the input form is not specified

getOutputForm

public abstract Form getOutputForm()
Returns the result form. Must be implemented in a subclass.

Specified by:
getOutputForm in interface Function
Returns:
null if the output form is not specified

hasSig

public boolean hasSig(Form[] inputForms,
                      Form outputForm)
Checks if the function has the given signature.

Specified by:
hasSig in interface Function

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object