Class Environment

java.lang.Object
org.moeaframework.util.tree.Environment

public class Environment extends Object
The execution context, or environment, storing the named variables used by a program. Defined functions are first-class objects and also stored in the environment.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new, empty environment.
    Constructs a new environment enclosed within the specified enclosing environment.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(Class<T> type, String name)
    Returns the content of the named variable stored in this environment or its enclosing environment; or null if the variable has not yet been defined.
    void
    set(String name, Object value)
    Sets the content of the named variable to the specified value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Environment

      public Environment()
      Constructs a new, empty environment.
    • Environment

      public Environment(Environment parent)
      Constructs a new environment enclosed within the specified enclosing environment.
      Parameters:
      parent - the enclosing environment
  • Method Details

    • get

      public <T> T get(Class<T> type, String name)
      Returns the content of the named variable stored in this environment or its enclosing environment; or null if the variable has not yet been defined.
      Type Parameters:
      T - the type of the variable
      Parameters:
      type - the type of the variable
      name - the name of the variable
      Returns:
      the content of the named variable stored in this environment or its enclosing environment; or null if the variable has not yet been defined
    • set

      public void set(String name, Object value)
      Sets the content of the named variable to the specified value.
      Parameters:
      name - the name of the variable
      value - the value to store in the variable