Class JavaMacro
java.lang.Object
weka.core.expressionlanguage.common.JavaMacro
- All Implemented Interfaces:
Macro
,MacroDeclarations
A macro declarations that exposes the java macro to a program.
The java macro can be used as follows
java(class, signature, arguments)
Where class is the name of class, signature is the signature of the function
and arguments is a list of arguments passed to the java function.
The signature follows the pattern:
type name '(' [ type [ ',' type ]* ] ')'
where type is one of 'boolean', 'double' or 'String' and name must be a valid
java identifier.
Examples:
java('java.lang.Math', 'double sqrt(double)', 4.0)
java('java.lang.String', 'String valueOf(double)', 2^30)
- Version:
- $Revision: 1000 $
- Author:
- Benjamin Weber ( benweber at student dot ethz dot ch )
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
JavaMacro
public JavaMacro()
-
-
Method Details
-
evaluate
Evaluates the java macro on the given arguments- Specified by:
evaluate
in interfaceMacro
- Parameters:
nodes
- the arguments to the java macro- Returns:
- an AST node returned by the macro
- Throws:
SemanticException
-
hasMacro
Whether the macro declarations contains the macro- Specified by:
hasMacro
in interfaceMacroDeclarations
- Parameters:
name
- name of the macro- Returns:
- whether the macro is declared
-
getMacro
Description copied from interface:MacroDeclarations
Tries to fetch the macro Before a macro is fetched it shold be checked whether it is declared throughMacroDeclarations.hasMacro(String)
- Specified by:
getMacro
in interfaceMacroDeclarations
- Returns:
-