Class ValueEnvironment

java.lang.Object
com.aquima.interactions.expressions.environment.ValueEnvironment
All Implemented Interfaces:
IValueEnvironment

public class ValueEnvironment extends Object implements 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 Details

    • ValueEnvironment

      public ValueEnvironment(IValueSource source)
      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 interface IValueEnvironment
    • 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 interface IValueEnvironment
    • declareVariable

      public void declareVariable(Identifier name, IValue localValue)
      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 interface IValueEnvironment
      Parameters:
      name - The name of the identifier.
      localValue - The value of the identifier which should never be null
    • getValue

      public IValue getValue(Identifier name)
      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 interface IValueEnvironment
      Parameters:
      name - The name of the identifier.
      Returns:
      The assigned value for the variable which is never null
    • getAllObjectsForType

      public IListValue getAllObjectsForType(Identifier name, boolean includeDerivedObjects)
      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 interface IValueEnvironment
      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

      public IValue getNamedObjectValue(Identifier objectName, Identifier name)
      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 interface IValueEnvironment
      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

      public IValueSource getValueSource()
      Description copied from interface: IValueEnvironment
      This function returns the value source which is the rootscope for this expression evaluation.
      Specified by:
      getValueSource in interface IValueEnvironment
      Returns:
      The value source object for this expression, this object should never be null.