Class RuntimeEnvironment.Context<D extends VariableDeclaration,​O extends IModel>

  • Type Parameters:
    D - the variable declaration type
    O - the model type
    Enclosing class:
    RuntimeEnvironment<V extends VariableDeclaration,​M extends IModel>

    private class RuntimeEnvironment.Context<D extends VariableDeclaration,​O extends IModel>
    extends java.lang.Object
    Defines a context for executing one model within.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • Context

        public Context​(IResolvableModel<D,​O> model)
        Creates a new context.
        Parameters:
        model - the related model
    • Method Detail

      • getModel

        public IResolvableModel<D,​O> getModel()
        Returns the model.
        Returns:
        the model
      • getValue

        public java.lang.Object getValue​(IResolvable resolvable)
                                  throws VilException
        Returns the value of resolvable.
        Parameters:
        resolvable - the variable to return the value for
        Returns:
        the value of resolvable
        Throws:
        VilException - in case that resolvable was not defined
      • get

        public D get​(java.lang.String name)
        Returns the variable of name name if defined.
        Parameters:
        name - the name of the variable
        Returns:
        the variable or null if not found
      • isDefined

        public boolean isDefined​(D var)
        Returns whether var is defined (a value was assigned).
        Parameters:
        var - the variable to look for
        Returns:
        true if var is defined, false else
      • isDefined

        private boolean isDefined​(D var,
                                  int maxIndex)
        Returns whether var is defined (a value was assigned).
        Parameters:
        var - the variable to look for
        maxIndex - the maximum level index to start searching for
        Returns:
        true if var is defined, false else
      • setValue

        public void setValue​(D var,
                             java.lang.Object object)
                      throws VilException
        Changes the value of var where it is defined.
        Parameters:
        var - the variable to be modified
        object - the value of var
        Throws:
        VilException - in case of an attempt of modifying a constant
      • pushLevel

        public void pushLevel()
        Pushes a new level.
      • popLevel

        public void popLevel()
                      throws VilException
        Removes the topmost level.
        Throws:
        VilException - in case that storing artifacts fails, the level will be popped anyway
      • addValue

        public void addValue​(D var,
                             java.lang.Object object)
                      throws VilException
        Changes the value of var to the top level.
        Parameters:
        var - the variable to be modified
        object - the value of var
        Throws:
        VilException - in case of an attempt of modifying a constant
      • removeValue

        public void removeValue​(D var)
        Removes the binding for var from the top level.
        Parameters:
        var - the variable to be removed
      • getIndentationConfiguration

        public IndentationConfiguration getIndentationConfiguration()
        Returns the indentation information for the underlying model.
        Returns:
        the indentation information
      • getIndentation

        public int getIndentation()
        Returns the current indentation.
        Returns:
        the current indentation (in single whitespaces)
      • setIndentationSteps

        public void setIndentationSteps​(int steps)
        Changes the current indentation (in steps).
        Parameters:
        steps - the number of indentation steps
      • setIndentation

        public void setIndentation​(int indentation)
        Changes the current indentation.
        Parameters:
        indentation - the new indentation (in single whitespaces)
      • increaseIndentation

        public void increaseIndentation()
        Increases the indentation by one step.
      • decreaseIndentation

        public void decreaseIndentation()
        Decreases the indentation by one step.
      • getIvmlValue

        public java.lang.Object getIvmlValue​(java.lang.String name)
                                      throws VilException
        Returns the value of the IVML element denoted by name in the closest scope defining an IVML configuration.
        Parameters:
        name - the name
        Returns:
        the value
        Throws:
        VilException - in case that name was not defined
      • getTopLevelConfiguration

        public Configuration getTopLevelConfiguration()
        Returns the top-level configuration based on defining global VIL/VTL script parameters.
        Returns:
        the top-level configuration (may be null if unknown)