org.jaitools.jiffle.parser
Class FunctionInfo

java.lang.Object
  extended by org.jaitools.jiffle.parser.FunctionInfo

public class FunctionInfo
extends java.lang.Object

Used by the FunctionLookup class when servicing lookup requests from the Jiffle compiler.

Since:
0.1
Version:
$Id: FunctionInfo.java 1653 2011-06-16 10:23:02Z michael.bedward $
Author:
Michael Bedward

Nested Class Summary
static class FunctionInfo.Provider
          Constants to indicate the runtime provider of a function
 
Constructor Summary
FunctionInfo(java.lang.String jiffleName, java.lang.String runtimeName, FunctionInfo.Provider provider, boolean isVolatile, java.lang.String returnType, java.lang.String... argTypes)
          Creates a function info object.
 
Method Summary
 java.lang.String getJiffleName()
          Gets the name of the function used in Jiffle scripts.
 int getNumArgs()
          Gets the number of arguments used by the function.
 java.lang.String getReturnType()
          Gets the function return type.
 java.lang.String getRuntimeExpr()
          Gets the Java source for the function provider and name used in the runtime class.
 boolean isProxy()
          Tests if this is a proxy function, ie.
 boolean isVolatile()
          Tests if this function is volatile, ie.
 boolean matches(java.lang.String name, java.util.List<java.lang.String> argTypes)
          Tests if this object matches the given name and argument types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionInfo

public FunctionInfo(java.lang.String jiffleName,
                    java.lang.String runtimeName,
                    FunctionInfo.Provider provider,
                    boolean isVolatile,
                    java.lang.String returnType,
                    java.lang.String... argTypes)
Creates a function info object.

Parameters:
jiffleName - name of the function used in Jiffle scripts
runtimeName - Java name used in runtime class source
provider - the provider: one of FunctionInfo.Provider.JIFFLE, FunctionInfo.Provider.MATH or FunctionInfo.Provider.PROXY
isVolatile - true if the function returns a new value on each invocation regardless of pixel position (e.g. rand()); false otherwise
returnType - function return type ("D", "List")
argTypes - array of Strings specifying argument types; null or empty for no-arg functions
Method Detail

getJiffleName

public java.lang.String getJiffleName()
Gets the name of the function used in Jiffle scripts.

Returns:
Jiffle function name

getRuntimeExpr

public java.lang.String getRuntimeExpr()
Gets the Java source for the function provider and name used in the runtime class.

Returns:
runtime class source for the function

isVolatile

public boolean isVolatile()
Tests if this function is volatile, ie. returns a different value on each invocation regardless of image position.

Returns:
true if volatile, false otherwise

getNumArgs

public int getNumArgs()
Gets the number of arguments used by the function.

Returns:
number of arguments

isProxy

public boolean isProxy()
Tests if this is a proxy function, ie. one that is translated to a runtime class field defined by Jiffle. Examples are x() and width().

Returns:
true is a proxy function; false otherwise

getReturnType

public java.lang.String getReturnType()
Gets the function return type.

Returns:
return type: "D" or "List"

matches

public boolean matches(java.lang.String name,
                       java.util.List<java.lang.String> argTypes)
Tests if this object matches the given name and argument types.

Parameters:
name - function name used in scripts
argTypes - argument type names; null or empty for no-arg functions
Returns:
true if this object matches; false otherwise


Copyright © 2011. All Rights Reserved.