Class JavaMacro
- java.lang.Object
-
- weka.core.expressionlanguage.common.JavaMacro
-
- All Implemented Interfaces:
Macro,MacroDeclarations
public class JavaMacro extends java.lang.Object implements MacroDeclarations, Macro
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
Constructors Constructor Description JavaMacro()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Nodeevaluate(Node... nodes)Evaluates the java macro on the given argumentsMacrogetMacro(java.lang.String name)Tries to fetch the macrobooleanhasMacro(java.lang.String name)Whether the macro declarations contains the macro
-
-
-
Method Detail
-
evaluate
public Node evaluate(Node... nodes) throws SemanticException
Evaluates the java macro on the given arguments- Specified by:
evaluatein interfaceMacro- Parameters:
nodes- the arguments to the java macro- Returns:
- an AST node returned by the macro
- Throws:
SemanticException
-
hasMacro
public boolean hasMacro(java.lang.String name)
Whether the macro declarations contains the macro- Specified by:
hasMacroin interfaceMacroDeclarations- Parameters:
name- name of the macro- Returns:
- whether the macro is declared
-
getMacro
public Macro getMacro(java.lang.String name)
Description copied from interface:MacroDeclarationsTries to fetch the macro Before a macro is fetched it shold be checked whether it is declared throughMacroDeclarations.hasMacro(String)- Specified by:
getMacroin interfaceMacroDeclarations- Returns:
-
-