weka.core.expressionlanguage.common

## 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 and Description
    `JavaMacro()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Node` | `evaluate(Node... nodes)` Evaluates the java macro on the given arguments
    `Macro` | `getMacro(java.lang.String name)` Tries to fetch the macro
    `boolean` | `hasMacro(java.lang.String name)` Whether the macro declarations contains the macro

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JavaMacro

          public JavaMacro()

  - ### Method Detail

    - #### evaluate

          public Node evaluate(Node... nodes)
                        throws SemanticException

      Evaluates the java macro on the given arguments
      Specified by:
        `evaluate` in interface `Macro`
      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:
        `hasMacro` in interface `MacroDeclarations`
      Parameters:
        `name` - name of the macro
      Returns:
        whether the macro is declared

    - #### getMacro

          public Macro getMacro(java.lang.String name)

      Description copied from interface: `MacroDeclarations`
      Tries to fetch the macro Before a macro is fetched it shold be checked whether it is declared through `MacroDeclarations.hasMacro(String)`
      Specified by:
        `getMacro` in interface `MacroDeclarations`
      Returns: