Class EvaluationVisitor.EvaluationContextImpl

  • All Implemented Interfaces:
    IConfiguration
    Enclosing class:
    EvaluationVisitor

    private class EvaluationVisitor.EvaluationContextImpl
    extends EvaluationContext
    Implements the evaluation context. The context may contain nested local configurations in order to represent the nested (recursive) execution of operations defining parameters or local variables (let). Decision variables are searched along this stack starting at the top.
    Author:
    Holger Eichelberger
    • Field Detail

      • allowPropagation

        private boolean allowPropagation
    • Constructor Detail

      • EvaluationContextImpl

        EvaluationContextImpl​(IConfiguration config)
        Creates the context.
        Parameters:
        config - the variability model configuration (outermost stack level)
    • Method Detail

      • clear

        void clear()
        Clears this instance for reuse.
      • pushLevel

        void pushLevel​(IConfiguration config)
        Pushes a level.
        Parameters:
        config - the configuration to be pushed
      • popLevel

        void popLevel()
        Pops the top-most configuration level.
      • allowAssignValues

        public boolean allowAssignValues()
        Description copied from class: EvaluationContext
        Returns whether values shall be assigned, i.e., the configuration may be changed.
        Specified by:
        allowAssignValues in class EvaluationContext
        Returns:
        true if values shall be assigned, false else
      • getTargetState

        public IAssignmentState getTargetState​(IDecisionVariable var)
        Description copied from class: EvaluationContext
        Returns the target state of the evaluation for variable.
        Specified by:
        getTargetState in class EvaluationContext
        Parameters:
        var - the variable to return the target state for (do not modify!!!)
        Returns:
        the target state (may be null if the actual value cannot be assigned do to a state conflict)
      • getAllInstances

        public Value getAllInstances​(IDatatype type)
        Description copied from interface: IConfiguration
        Returns all instances of type.
        Parameters:
        type - the type to return the instances for
        Returns:
        all instances of type in terms of a container value consisting of references (may be null if this is not possible, e.g., in case of Integer)
      • bind

        Value bind​(IDatatype type)
        Binds the type to the first/closest definition of type.
        Parameters:
        type - the type to search for
        Returns:
        the value (may be null if there is none)
      • allowPropagation

        public boolean allowPropagation()
        Description copied from class: EvaluationContext
        Returns whether the expression to be evaluated is a propagation.
        Specified by:
        allowPropagation in class EvaluationContext
        Returns:
        true if it is a propagation, i.e. propagation shall be allowed, false else
      • setAllowPropagation

        boolean setAllowPropagation​(Operation op,
                                    boolean inPropagation)
        Changes the propagation state of this context.
        Parameters:
        inPropagation - whether we are currently in a propagation
        op - a filter for allowing propagation, basically implies is allow to change or null (no operation as filter)
        Returns:
        the propagation state before