org.rubato.logeo.functions
Class ModuleMorphismFunction

java.lang.Object
  extended by org.rubato.logeo.functions.AbstractFunction
      extended by org.rubato.logeo.functions.ModuleMorphismFunction
All Implemented Interfaces:
Function

public class ModuleMorphismFunction
extends AbstractFunction

A function from a simple denotator to a simple denotator, implement with a module morphism on the underlying modules.

Author:
Gérard Milmeister

Constructor Summary
ModuleMorphismFunction(ModuleMorphism morphism)
          Creates a function implemented by morphism.
ModuleMorphismFunction(ModuleMorphism morphism, SimpleForm resultForm)
          Creates a function implemented by morphism.
 
Method Summary
 Function compose(Function f)
          Returns a new function, the composition of this and f, i.e., this(f(x)).
 Denotator evaluate(Denotator... denotators)
          Evaluates the function with a list of arguments.
 int getArity()
          Returns the arity of the function.
 Form getInputForm(int i)
          Returns the ith argument form.
 ModuleMorphism getModuleMorphism()
           
 java.lang.String getName()
          Returns the name of the function.
 Form getOutputForm()
          Returns the result form.
 
Methods inherited from class org.rubato.logeo.functions.AbstractFunction
hasSig, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModuleMorphismFunction

public ModuleMorphismFunction(ModuleMorphism morphism)
                       throws RubatoException
Creates a function implemented by morphism. The domain and the codomain must be equal. The result denotator has the same form as the input denotator.

Throws:
RubatoException

ModuleMorphismFunction

public ModuleMorphismFunction(ModuleMorphism morphism,
                              SimpleForm resultForm)
                       throws RubatoException
Creates a function implemented by morphism. The domain and codomain are arbitrary, therefore the form of the result denotator must be specified. This (simple) form must have a module equal to the codomain of the morphism.

Throws:
RubatoException
Method Detail

evaluate

public Denotator evaluate(Denotator... denotators)
                   throws RubatoException
Description copied from class: AbstractFunction
Evaluates the function with a list of arguments.

Specified by:
evaluate in interface Function
Specified by:
evaluate in class AbstractFunction
Throws:
RubatoException

getArity

public int getArity()
Description copied from class: AbstractFunction
Returns the arity of the function. Must be implemented in a subclass.

Specified by:
getArity in interface Function
Specified by:
getArity in class AbstractFunction

compose

public Function compose(Function f)
                 throws RubatoException
Description copied from class: AbstractFunction
Returns a new function, the composition of this and f, i.e., this(f(x)).

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

getName

public java.lang.String getName()
Description copied from class: AbstractFunction
Returns the name of the function.

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

getInputForm

public Form getInputForm(int i)
Description copied from class: AbstractFunction
Returns the ith argument form. Must be implemented in a subclass.

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

getOutputForm

public Form getOutputForm()
Description copied from class: AbstractFunction
Returns the result form. Must be implemented in a subclass.

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

getModuleMorphism

public ModuleMorphism getModuleMorphism()