Class RescheduleValueChangeVisitor
- java.lang.Object
-
- net.ssehub.easy.varModel.model.values.ValueVisitorAdapter
-
- net.ssehub.easy.reasoning.sseReasoner.RescheduleValueChangeVisitor
-
- All Implemented Interfaces:
IValueChangeListener,IValueVisitor
class RescheduleValueChangeVisitor extends ValueVisitorAdapter implements IValueChangeListener
Reschedules value changes. Uses the provided resolver instance to perform further transformations and to register new constraints with the constraint base.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.varModel.cstEvaluation.IValueChangeListener
IValueChangeListener.ChangeKind
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclearprivate static EASyLoggerFactory.EASyLoggerLOGGERprivate ValueoldValueprivate Resolverresolverprivate IDecisionVariablevariableprivate IDecisionVariablevarParent
-
Constructor Summary
Constructors Constructor Description RescheduleValueChangeVisitor(Resolver resolver)Creates a rescheduling value change visitor for a certain resolver instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanisValueTypeChange(IDecisionVariable variable, Value newValue, Value oldValue)Returns whether a value change fromoldValuetonewValueonvariableis a value type change.voidnotifyChanged(IDecisionVariable variable, Value oldValue, IAssignmentState oldState, IValueChangeListener.ChangeKind kind)Called if the value of a variable has been modified.voidnotifyUnresolved(IDecisionVariable variable)Called if an assignment to the givenvariablefailed as the defining expression cannot be evaluated, e.g., due to an undefined variable.private voidrescheduleConstraintsForChilds(IDecisionVariable variable, boolean decl)Determines the constraints needed forvariableand its (transitive) child slots.private voidrescheduleConstraintsForParent(IDecisionVariable variable)Determines the constraints needed for the parents ofvariable.(package private) voidrescheduleValueChange(IDecisionVariable varParent, IDecisionVariable variable, Value oldValue, boolean clear)Re-schedules a changed constraint value but only if rescheduling is needed.voidvisitCompoundValue(CompoundValue newValue)This method is used for visiting CompoundValue.voidvisitConstraintValue(ConstraintValue value)This method is used for visiting ConstraintValue.voidvisitContainerValue(ContainerValue newValue)This method is used for visiting ContainerValue.-
Methods inherited from class net.ssehub.easy.varModel.model.values.ValueVisitorAdapter
visitBooleanValue, visitEnumValue, visitIntValue, visitMetaTypeValue, visitNullValue, visitRealValue, visitReferenceValue, visitStringValue, visitVersionValue
-
-
-
-
Field Detail
-
LOGGER
private static final EASyLoggerFactory.EASyLogger LOGGER
-
resolver
private Resolver resolver
-
clear
private boolean clear
-
oldValue
private Value oldValue
-
variable
private IDecisionVariable variable
-
varParent
private IDecisionVariable varParent
-
-
Constructor Detail
-
RescheduleValueChangeVisitor
public RescheduleValueChangeVisitor(Resolver resolver)
Creates a rescheduling value change visitor for a certain resolver instance.- Parameters:
resolver- the resolver instance
-
-
Method Detail
-
visitConstraintValue
public void visitConstraintValue(ConstraintValue value)
Description copied from interface:IValueVisitorThis method is used for visiting ConstraintValue.- Specified by:
visitConstraintValuein interfaceIValueVisitor- Overrides:
visitConstraintValuein classValueVisitorAdapter- Parameters:
value- One ConstraintValue which should be visited.
-
visitCompoundValue
public void visitCompoundValue(CompoundValue newValue)
Description copied from interface:IValueVisitorThis method is used for visiting CompoundValue.- Specified by:
visitCompoundValuein interfaceIValueVisitor- Overrides:
visitCompoundValuein classValueVisitorAdapter- Parameters:
newValue- One CompoundValue which should be visited.
-
visitContainerValue
public void visitContainerValue(ContainerValue newValue)
Description copied from interface:IValueVisitorThis method is used for visiting ContainerValue.- Specified by:
visitContainerValuein interfaceIValueVisitor- Overrides:
visitContainerValuein classValueVisitorAdapter- Parameters:
newValue- One CompoundValue which should be visited.
-
rescheduleValueChange
void rescheduleValueChange(IDecisionVariable varParent, IDecisionVariable variable, Value oldValue, boolean clear)
Re-schedules a changed constraint value but only if rescheduling is needed.- Parameters:
varParent- the parent variable holdingvariable, if not nested usevariablevariable- the variable for which the value changedoldValue- the old valueclear- whether constraints forholdershall be cleared
-
notifyChanged
public void notifyChanged(IDecisionVariable variable, Value oldValue, IAssignmentState oldState, IValueChangeListener.ChangeKind kind)
Description copied from interface:IValueChangeListenerCalled if the value of a variable has been modified.- Specified by:
notifyChangedin interfaceIValueChangeListener- Parameters:
variable- the modified variableoldValue- the value ofvariablebefore the change (may be null)oldState- the old state of the variable before the changekind- the change kind
-
notifyUnresolved
public void notifyUnresolved(IDecisionVariable variable)
Description copied from interface:IValueChangeListenerCalled if an assignment to the givenvariablefailed as the defining expression cannot be evaluated, e.g., due to an undefined variable.- Specified by:
notifyUnresolvedin interfaceIValueChangeListener- Parameters:
variable- the variable that the evaluator was about to modify
-
isValueTypeChange
private boolean isValueTypeChange(IDecisionVariable variable, Value newValue, Value oldValue)
Returns whether a value change fromoldValuetonewValueonvariableis a value type change.- Parameters:
variable- the variablenewValue- the new value (invariableoldValue- the old value- Returns:
truefor type change,falseelse
-
rescheduleConstraintsForParent
private void rescheduleConstraintsForParent(IDecisionVariable variable)
Determines the constraints needed for the parents ofvariable.- Parameters:
variable- the variable to analyze
-
rescheduleConstraintsForChilds
private void rescheduleConstraintsForChilds(IDecisionVariable variable, boolean decl)
Determines the constraints needed forvariableand its (transitive) child slots.- Parameters:
variable- the variable to analyzedecl- reschedule on the declaration ofvariableor onvariableitself
-
-