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
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(EvaluationVisitor.Message message) Adds an evaluation message.booleanReturns whether values shall be assigned, i.e., the configuration may be changed.booleanReturns whether the expression to be evaluated is a propagation.(package private) ValueBinds the type to the first/closest definition of type.(package private) voidclear()Clears this instance for reuse.getAllInstances(IDatatype type) Returns all instances oftype.Returns the global (target) assignment state for the actual evaluation.getDecision(AbstractVariable variable) Returns the specifiedIDecisionVariable.Returns the target state of the evaluation forvariable.voidIndicates that the evaluation of this constraint shall lead to a warning.voidnotifyChangeListener(IDecisionVariable variable, Value value, IAssignmentState oldState, IValueChangeListener.ChangeKind kind) Notifies the change listener, i.e., the value ofvariablehas changed.(package private) voidpopLevel()Pops the top-most configuration level.(package private) voidpushLevel(IConfiguration config) Pushes a level.(package private) EvaluationVisitor.EvaluationContextImplreset(IConfiguration config) Resets this instance for reuse.(package private) booleansetAllowPropagation(Operation op, boolean inPropagation) Changes the propagation state of this context.Methods inherited from class net.ssehub.easy.varModel.cstEvaluation.EvaluationContext
addErrorMessage, addErrorMessage, addErrorMessage, getCollator, getDereferencedValue, getLocale, setLocale
-
Field Details
-
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:
clearin classEvaluationContext
-
pushLevel
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:EvaluationContextReturns whether values shall be assigned, i.e., the configuration may be changed.- Specified by:
allowAssignValuesin classEvaluationContext- Returns:
trueif values shall be assigned,falseelse
-
notifyChangeListener
public void notifyChangeListener(IDecisionVariable variable, Value value, IAssignmentState oldState, IValueChangeListener.ChangeKind kind) Description copied from class:EvaluationContextNotifies the change listener, i.e., the value ofvariablehas changed.- Specified by:
notifyChangeListenerin classEvaluationContext- Parameters:
variable- the changed variablevalue- the value ofvariablebefore the change (may be null)oldState- the old state ofvariablebefore the changekind- the change kind
-
addMessage
Description copied from class:EvaluationContextAdds an evaluation message.- Specified by:
addMessagein classEvaluationContext- Parameters:
message- the message to be added
-
getTargetState
Description copied from class:EvaluationContextReturns the target state of the evaluation forvariable.- Specified by:
getTargetStatein classEvaluationContext- 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
Description copied from interface:IConfigurationReturns the specifiedIDecisionVariable.- Parameters:
variable- The declaration for which the configuration entity should be returned.- Returns:
- The
IDecisionVariablefor the given declaration
-
getAllInstances
Description copied from interface:IConfigurationReturns all instances oftype.- 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
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:EvaluationContextIndicates that the evaluation of this constraint shall lead to a warning.- Specified by:
issueWarningin classEvaluationContext
-
allowPropagation
public boolean allowPropagation()Description copied from class:EvaluationContextReturns whether the expression to be evaluated is a propagation.- Specified by:
allowPropagationin classEvaluationContext- Returns:
trueif it is a propagation, i.e. propagation shall be allowed,falseelse
-
setAllowPropagation
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
Description copied from class:EvaluationContextReturns the global (target) assignment state for the actual evaluation. This may differ fromEvaluationContext.getTargetState(IDecisionVariable).- Specified by:
getAssignmentStatein classEvaluationContext- Returns:
- the assignment state
-