Class VariableDeclarationsCompositor
java.lang.Object
weka.core.expressionlanguage.common.VariableDeclarationsCompositor
- All Implemented Interfaces:
Serializable,VariableDeclarations
A helper class that allows to combine several variable declarations together.
It can be thought of as layering several scopes over one another.
It will delegate the
hasVariable(String) and getVariable(String)
methods to other variable declarations.
Each variable 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 )
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVariableDeclarationsCompositor(VariableDeclarations... declarations) Constructs aVariableDeclarationsCompositorcontaining the provided declarations -
Method Summary
Modifier and TypeMethodDescriptiongetVariable(String name) Tries to fetch a variable from one of the combined declarations.booleanhasVariable(String name) Whether the variable is contained in one of the combined declarations.
-
Constructor Details
-
VariableDeclarationsCompositor
Constructs aVariableDeclarationsCompositorcontaining the provided declarations The order of the declarations will determine the order of checking the declarations for variables.- Parameters:
declarations- the declarations being combined
-
-
Method Details
-
hasVariable
Whether the variable is contained in one of the combined declarations.- Specified by:
hasVariablein interfaceVariableDeclarations- Parameters:
name- name of the variable- Returns:
- whether the variable is contained in one of the combined declarations
-
getVariable
Tries to fetch a variable from one of the combined declarations. The same invariant ofVariableDeclarationsapplies here too.- Specified by:
getVariablein interfaceVariableDeclarations- Parameters:
name- the name of the variable to be fetched- Returns:
- an AST (abstract syntax tree) node representing the variable
-