Package org.moeaframework.util.tree
Class Environment
java.lang.Object
org.moeaframework.util.tree.Environment
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
ConstructorDescriptionConstructs a new, empty environment.Environment
(Environment parent) Constructs a new environment enclosed within the specified enclosing environment. -
Method Summary
Modifier and TypeMethodDescription<T> T
Returns the content of the named variable stored in this environment or its enclosing environment; ornull
if the variable has not yet been defined.void
Sets the content of the named variable to the specified value.
-
Constructor Details
-
Environment
public Environment()Constructs a new, empty environment. -
Environment
Constructs a new environment enclosed within the specified enclosing environment.- Parameters:
parent
- the enclosing environment
-
-
Method Details
-
get
Returns the content of the named variable stored in this environment or its enclosing environment; ornull
if the variable has not yet been defined.- Type Parameters:
T
- the type of the variable- Parameters:
type
- the type of the variablename
- 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
Sets the content of the named variable to the specified value.- Parameters:
name
- the name of the variablevalue
- the value to store in the variable
-