Class MacroDeclarationsCompositor

java.lang.Object
weka.core.expressionlanguage.common.MacroDeclarationsCompositor
All Implemented Interfaces:
MacroDeclarations

public class MacroDeclarationsCompositor extends 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 Details

    • 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 Details

    • hasMacro

      public boolean hasMacro(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(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