org.imemex.functions
Class AbstractFunction

java.lang.Object
  extended by org.imemex.functions.AbstractFunction
All Implemented Interfaces:
Function
Direct Known Subclasses:
BasicSystemFunctions.Add, BasicSystemFunctions.AddDate, BasicSystemFunctions.Divide, BasicSystemFunctions.Multiply, BasicSystemFunctions.NthRoot, BasicSystemFunctions.StringSimilarity, BasicSystemFunctions.Substract, BasicSystemFunctions.SubstractDate, BasicSystemFunctions.Today, BasicSystemFunctions.TodayN, BasicSystemFunctions.Year, BasicSystemFunctions.Yesterday, LineageFunction

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

Version:
1.0
Author:
ogirard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.imemex.functions.Function
Function.FuncType
 
Constructor Summary
AbstractFunction(Function.FuncType type, java.lang.String name, java.lang.Class<?> retType, java.util.List<java.lang.Class<?>> argTypes)
           
 
Method Summary
 boolean checkSignature(java.lang.String name, java.lang.Class<?> retType, java.util.List<java.lang.Class<?>> argTypes)
          checks if the signature of this function matches
abstract  java.lang.Object execute(java.util.List<java.lang.Object> args)
          executes this function
 java.util.List<java.lang.Class<?>> getArgTypes()
          gets ordered types of arguments
 java.lang.String getID()
          gets unique id of this function
 java.lang.String getName()
          gets name of this function
 java.lang.Class<?> getReturnType()
          gets type of of return value
 Function.FuncType getType()
          gets type of this function
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFunction

public AbstractFunction(Function.FuncType type,
                        java.lang.String name,
                        java.lang.Class<?> retType,
                        java.util.List<java.lang.Class<?>> argTypes)
Method Detail

execute

public abstract java.lang.Object execute(java.util.List<java.lang.Object> args)
                                  throws InvalidArgumentsException
Description copied from interface: Function
executes this function

Specified by:
execute in interface Function
Parameters:
args - list of arguments (order & type have to match!)
Returns:
result of this function
Throws:
InvalidArgumentsException - if wrong argument types, values or nr of args incorrect

checkSignature

public boolean checkSignature(java.lang.String name,
                              java.lang.Class<?> retType,
                              java.util.List<java.lang.Class<?>> argTypes)
Description copied from interface: Function
checks if the signature of this function matches

Specified by:
checkSignature in interface Function
Returns:

getArgTypes

public java.util.List<java.lang.Class<?>> getArgTypes()
Description copied from interface: Function
gets ordered types of arguments

Specified by:
getArgTypes in interface Function
Returns:

getID

public final java.lang.String getID()
Description copied from interface: Function
gets unique id of this function

Specified by:
getID in interface Function
Returns:

getName

public java.lang.String getName()
Description copied from interface: Function
gets name of this function

Specified by:
getName in interface Function
Returns:
name as String

getReturnType

public java.lang.Class<?> getReturnType()
Description copied from interface: Function
gets type of of return value

Specified by:
getReturnType in interface Function
Returns:

getType

public Function.FuncType getType()
Description copied from interface: Function
gets type of this function

Specified by:
getType in interface Function
Returns:
type
See Also:
Function.FuncType