Class EvaluationContext
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.EvaluationContext
- All Implemented Interfaces:
IConfiguration
- Direct Known Subclasses:
EvaluationVisitor.EvaluationContextImpl
Some basic functionality required by the evaluators without exposing the
EvaluationVisitor.- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorMessage(String message, int code) Adds an evaluation error message.voidaddErrorMessage(String message, IDecisionVariable variable, int code) Adds an evaluation error message.voidaddErrorMessage(Throwable throwable) Adds an evaluation error message based on a throwable.abstract voidaddMessage(EvaluationVisitor.Message message) Adds an evaluation message.abstract booleanReturns whether values shall be assigned, i.e., the configuration may be changed.abstract booleanReturns whether the expression to be evaluated is a propagation.(package private) voidclear()Clears this instance for reuse.abstract IAssignmentStateReturns the global (target) assignment state for the actual evaluation.Returns the collator corresponding to the actual locale of this context.getDereferencedValue(Value value) Dereferences a value within this context.Returns the actual locale for evaluation.abstract IAssignmentStategetTargetState(IDecisionVariable variable) Returns the target state of the evaluation forvariable.abstract voidIndicates that the evaluation of this constraint shall lead to a warning.abstract voidnotifyChangeListener(IDecisionVariable variable, Value oldValue, IAssignmentState oldState, IValueChangeListener.ChangeKind kind) Notifies the change listener, i.e., the value ofvariablehas changed.voidChanges the locale for evaluation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ssehub.easy.varModel.confModel.IConfiguration
getAllInstances, getDecision
-
Field Details
-
locale
-
-
Constructor Details
-
EvaluationContext
public EvaluationContext()
-
-
Method Details
-
clear
void clear()Clears this instance for reuse. -
getLocale
Returns the actual locale for evaluation.- Returns:
- the locale
-
setLocale
Changes the locale for evaluation.- Parameters:
locale- the new locale, ignored if null
-
getCollator
Returns the collator corresponding to the actual locale of this context.- Returns:
- the collator
-
allowAssignValues
public abstract boolean allowAssignValues()Returns whether values shall be assigned, i.e., the configuration may be changed.- Returns:
trueif values shall be assigned,falseelse
-
notifyChangeListener
public abstract void notifyChangeListener(IDecisionVariable variable, Value oldValue, IAssignmentState oldState, IValueChangeListener.ChangeKind kind) Notifies the change listener, i.e., the value ofvariablehas changed.- Parameters:
variable- the changed variableoldValue- the value ofvariablebefore the change (may be null)oldState- the old state ofvariablebefore the changekind- the change kind
-
addMessage
Adds an evaluation message.- Parameters:
message- the message to be added
-
getTargetState
Returns the target state of the evaluation forvariable.- Parameters:
variable- 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)
-
addErrorMessage
Adds an evaluation error message.- Parameters:
message- the message to be addedcode- the error code
-
addErrorMessage
Adds an evaluation error message.- Parameters:
message- the message to be addedvariable- OptionalIDecisionVariablewhich caused the errorcode- the error code
-
addErrorMessage
Adds an evaluation error message based on a throwable.- Parameters:
throwable- the throwable carrying the message
-
issueWarning
public abstract void issueWarning()Indicates that the evaluation of this constraint shall lead to a warning. -
allowPropagation
public abstract boolean allowPropagation()Returns whether the expression to be evaluated is a propagation.- Returns:
trueif it is a propagation, i.e. propagation shall be allowed,falseelse
-
getDereferencedValue
Dereferences a value within this context.- Parameters:
value- the value to dereference- Returns:
- the dereferenced value (may be null if undefined)
-
getAssignmentState
Returns the global (target) assignment state for the actual evaluation. This may differ fromgetTargetState(IDecisionVariable).- Returns:
- the assignment state
-