weka.core.expressionlanguage.common

## Class MacroDeclarationsCompositor

- java.lang.Object
- - weka.core.expressionlanguage.common.MacroDeclarationsCompositor

- All Implemented Interfaces:
    MacroDeclarations

      public class MacroDeclarationsCompositor
      extends java.lang.Object
      implements MacroDeclarations

  A helper class that allows to combine several macro declarations together. It can be though of as layering several scopes over one another. It will delegate the `hasMacro(String)` and `getMacro(String)` methods to other macro declarations. Each macro declaration combined is checked in sequential order. No checks for conflicts are done. Thus shadowing is possible.
  Version:
    $Revision: 1000 $
  Author:
    Benjamin Weber ( benweber at student dot ethz dot ch )

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MacroDeclarationsCompositor(MacroDeclarations... declarations)` Constructs a `MacroDeclarationsCompositor` containing the provided declarations

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Macro` | `getMacro(java.lang.String name)` Tries to fetch a macro from one of the combined declarations.
    `boolean` | `hasMacro(java.lang.String name)` Whether the macro is contained in one of the combined declarations.

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

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

- - ### Constructor Detail

    - #### MacroDeclarationsCompositor

          public MacroDeclarationsCompositor(MacroDeclarations... declarations)

      Constructs a `MacroDeclarationsCompositor` containing the provided declarations The order of the declarations will determine the order of checking the declarations for macros.
      Parameters:
        `declarations` - the declarations being combined

  - ### Method Detail

    - #### hasMacro

          public boolean hasMacro(java.lang.String name)

      Whether the macro is contained in one of the combined declarations.
      Specified by:
        `hasMacro` in interface `MacroDeclarations`
      Parameters:
        `name` - name of the macro
      Returns:
        whether the macro is contained in one of the combined declarations

    - #### getMacro

          public Macro getMacro(java.lang.String name)

      Tries to fetch a macro from one of the combined declarations. The same invariant of `MacroDeclarations` applies here too.
      Specified by:
        `getMacro` in interface `MacroDeclarations`
      Parameters:
        `name` - the name of the macro to be fetched
      Returns:
        a macro