Class EvaluationVisitor.EvaluationContextImpl

java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationContext
net.ssehub.easy.varModel.cstEvaluation.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 Details

    • configStack

      private Stack<IConfiguration> configStack
    • allowPropagation

      private boolean allowPropagation
  • Constructor Details

    • EvaluationContextImpl

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

    • reset

      Resets this instance for reuse.
      Parameters:
      config - the variability model configuration (outermost stack level)
      Returns:
      this
    • clear

      void clear()
      Clears this instance for reuse.
      Overrides:
      clear in class EvaluationContext
    • 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
    • notifyChangeListener

      public void notifyChangeListener(IDecisionVariable variable, Value value, IAssignmentState oldState, IValueChangeListener.ChangeKind kind)
      Description copied from class: EvaluationContext
      Notifies the change listener, i.e., the value of variable has changed.
      Specified by:
      notifyChangeListener in class EvaluationContext
      Parameters:
      variable - the changed variable
      value - the value of variable before the change (may be null)
      oldState - the old state of variable before the change
      kind - the change kind
    • addMessage

      public void addMessage(EvaluationVisitor.Message message)
      Description copied from class: EvaluationContext
      Adds an evaluation message.
      Specified by:
      addMessage in class EvaluationContext
      Parameters:
      message - the message to be added
    • 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)
    • getDecision

      public IDecisionVariable getDecision(AbstractVariable variable)
      Description copied from interface: IConfiguration
      Returns the specified IDecisionVariable.
      Parameters:
      variable - The declaration for which the configuration entity should be returned.
      Returns:
      The IDecisionVariable for the given declaration
    • 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)
    • issueWarning

      public void issueWarning()
      Description copied from class: EvaluationContext
      Indicates that the evaluation of this constraint shall lead to a warning.
      Specified by:
      issueWarning in class EvaluationContext
    • 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:
      op - a filter for allowing propagation, basically implies is allow to change or null (no operation as filter)
      inPropagation - whether we are currently in a propagation
      Returns:
      the propagation state before
    • getAssignmentState

      public IAssignmentState getAssignmentState()
      Description copied from class: EvaluationContext
      Returns the global (target) assignment state for the actual evaluation. This may differ from EvaluationContext.getTargetState(IDecisionVariable).
      Specified by:
      getAssignmentState in class EvaluationContext
      Returns:
      the assignment state