weka.core.expressionlanguage.common

## Class VariableDeclarationsCompositor

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

- All Implemented Interfaces:
    java.io.Serializable, VariableDeclarations

      public class VariableDeclarationsCompositor
      extends java.lang.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 and Description
    `VariableDeclarationsCompositor(VariableDeclarations... declarations)` Constructs a `VariableDeclarationsCompositor` containing the provided declarations

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Node` | `getVariable(java.lang.String name)` Tries to fetch a variable from one of the combined declarations.
    `boolean` | `hasVariable(java.lang.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 Detail

    - #### 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 Detail

    - #### hasVariable

          public boolean hasVariable(java.lang.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(java.lang.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