Class ValueEnvironment
java.lang.Object
com.aquima.interactions.expressions.environment.ValueEnvironment
- All Implemented Interfaces:
IValueEnvironment
This class is an implementation of the IValueEnvironment interface which uses the ValueScope class to define elements
within the scope.
- Since:
- 6.0
- Author:
- F. van der Meer
-
Constructor Summary
ConstructorsConstructorDescriptionValueEnvironment
(IValueSource source) Constructs value environment in the root-scope setting for usage by the evaluator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This function starts a new scope in which variables can be declared.void
declareVariable
(Identifier name, IValue localValue) Assigns an identifier to a value, this identifier is created within the current scope and can therefore hide another variable of the same name.void
endScope()
This function ends the current scope and cleans up all the variables declared within this scope.getAllObjectsForType
(Identifier name, boolean includeDerivedObjects) Locates all objects for the specified type name.getNamedObjectValue
(Identifier objectName, Identifier name) Locates a named object value from the system.getValue
(Identifier name) Locates a value for the specified identifier.This function returns the value source which is the rootscope for this expression evaluation.
-
Constructor Details
-
ValueEnvironment
Constructs value environment in the root-scope setting for usage by the evaluator.- Parameters:
source
- The value source interface which represents the root value system ( often reffered to as: the profile )
-
-
Method Details
-
beginScope
public void beginScope()Description copied from interface:IValueEnvironment
This function starts a new scope in which variables can be declared. It allows for variable hiding until an end scope is called. Which in turn means a cleanup of the current scope.- Specified by:
beginScope
in interfaceIValueEnvironment
-
endScope
public void endScope()Description copied from interface:IValueEnvironment
This function ends the current scope and cleans up all the variables declared within this scope. If an end scope is called while there was no begin scope called previously an exception is thrown.- Specified by:
endScope
in interfaceIValueEnvironment
-
declareVariable
Description copied from interface:IValueEnvironment
Assigns an identifier to a value, this identifier is created within the current scope and can therefore hide another variable of the same name.- Specified by:
declareVariable
in interfaceIValueEnvironment
- Parameters:
name
- The name of the identifier.localValue
- The value of the identifier which should never be null
-
getValue
Description copied from interface:IValueEnvironment
Locates a value for the specified identifier. It will look within the current scope and up until it encounters the root scope.- Specified by:
getValue
in interfaceIValueEnvironment
- Parameters:
name
- The name of the identifier.- Returns:
- The assigned value for the variable which is never null
-
getAllObjectsForType
Description copied from interface:IValueEnvironment
Locates all objects for the specified type name. The boolean indicates whether child types are allowed to be part of the resulting list.- Specified by:
getAllObjectsForType
in interfaceIValueEnvironment
- Parameters:
name
- The type name of the object to be located.includeDerivedObjects
- A boolean indicating that child types of the typeName should be part of the resulting list.- Returns:
- An IListValue object containing all object values. The list should never be null
-
getNamedObjectValue
Description copied from interface:IValueEnvironment
Locates a named object value from the system. A named object is a special case for which the system can do a lookup.- Specified by:
getNamedObjectValue
in interfaceIValueEnvironment
- Parameters:
objectName
- The type name of the object to look for.name
- The name of the object (often called static-instance name)- Returns:
- The object value which is located, it should never be null
-
getValueSource
Description copied from interface:IValueEnvironment
This function returns the value source which is the rootscope for this expression evaluation.- Specified by:
getValueSource
in interfaceIValueEnvironment
- Returns:
- The value source object for this expression, this object should never be null.
-