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 thehasMacro(String)andgetMacro(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 Description MacroDeclarationsCompositor(MacroDeclarations... declarations)Constructs aMacroDeclarationsCompositorcontaining the provided declarations
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MacrogetMacro(java.lang.String name)Tries to fetch a macro from one of the combined declarations.booleanhasMacro(java.lang.String name)Whether the macro is contained in one of the combined declarations.
-
-
-
Constructor Detail
-
MacroDeclarationsCompositor
public MacroDeclarationsCompositor(MacroDeclarations... declarations)
Constructs aMacroDeclarationsCompositorcontaining 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:
hasMacroin interfaceMacroDeclarations- 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 ofMacroDeclarationsapplies here too.- Specified by:
getMacroin interfaceMacroDeclarations- Parameters:
name- the name of the macro to be fetched- Returns:
- a macro
-
-