Package weka.core.expressionlanguage.common

# Class VariableDeclarationsCompositor

java.lang.Object
weka.core.expressionlanguage.common.VariableDeclarationsCompositor

All Implemented Interfaces:
  `Serializable`, `VariableDeclarations`

public class VariableDeclarationsCompositor extends Object implements 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:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VariableDeclarationsCompositor(VariableDeclarations... declarations)`
  Constructs a `VariableDeclarationsCompositor` containing the provided declarations

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Node`
  `getVariable(String name)`
  Tries to fetch a variable from one of the combined declarations.
  `boolean`
  `hasVariable(String name)`
  Whether the variable 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 Details

  - ### VariableDeclarationsCompositor

    public VariableDeclarationsCompositor(VariableDeclarations... declarations)
    Constructs a `VariableDeclarationsCompositor` containing 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

    public boolean hasVariable(String name)
    Whether the variable is contained in one of the combined declarations.
    Specified by:
      `hasVariable` in interface `VariableDeclarations`
    Parameters:
      `name` - name of the variable
    Returns:
      whether the variable is contained in one of the combined declarations

  - ### getVariable

    public Node getVariable(String name)
    Tries to fetch a variable from one of the combined declarations. The same invariant of `VariableDeclarations` applies here too.
    Specified by:
      `getVariable` in interface `VariableDeclarations`
    Parameters:
      `name` - the name of the variable to be fetched
    Returns:
      an AST (abstract syntax tree) node representing the variable