Class ToplevelVarConfigProvider
java.lang.Object
net.ssehub.easy.varModel.confModel.VariableConfigProvider
net.ssehub.easy.varModel.confModel.ToplevelVarConfigProvider
VariableConfigProvider for not nested variables.- Author:
- El-Sharkawy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLoggerprivate IDecisionVariableprivate IAssignmentStateprivate Value -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedToplevelVarConfigProvider(IDecisionVariable relatedVariable, Value value, IAssignmentState state) Sole constructor for creating aVariableConfigProviderfor a toplevelIDecisionVariable. -
Method Summary
Modifier and TypeMethodDescriptionprivate ValueassignCompoundValue(CompoundValue value, IAssignmentState state, boolean allowDeletation, CompoundValue oldValue) Assigns a CompoundValue.private ValueassignContainerValue(ContainerValue conValue, IAssignmentState state, boolean allowDeletation) Assigns a ContainerValue.private voidassignValue(Value value, IAssignmentState state, boolean allowDeletation) Assigns a value.protected voidfreeze(IFreezeSelector selector) Causes to freeze the current value.protected final ConfigurationReturn theConfigurationwhere the relatedIDecisionVariablebelongs to.protected final AbstractVariableReturns the Declaration of the relatedIDecisionVariable.protected IAssignmentStategetState()Returns the assignment state of this variable.protected ValuegetValue()Returns the current value of thisIDecisionVariable.protected final booleanSpecifies whether the relatedIDecisionVariablecan have its ownIAssignmentState.protected voidsetHistoryValue(Value value, IAssignmentState state) Changes the value from value history.protected final voidsetState(IAssignmentState state) Setter for theIAssignmentState, needed byCompoundVariables.protected voidsetValue(Value value, IAssignmentState state) Changes the value (for incremental buildup).private voidsetValueImpl(Value value) Changes the value adjustingValue.setValueParent(net.ssehub.easy.varModel.model.values.IValueParent)the parent variable of the involved values).Methods inherited from class net.ssehub.easy.varModel.confModel.VariableConfigProvider
freeze, unfreeze
-
Field Details
-
LOGGER
private static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger LOGGER -
value
-
state
-
-
Constructor Details
-
ToplevelVarConfigProvider
protected ToplevelVarConfigProvider(IDecisionVariable relatedVariable, Value value, IAssignmentState state) Sole constructor for creating aVariableConfigProviderfor a toplevelIDecisionVariable.- Parameters:
relatedVariable- TheIDecisionVariablewhere thisVariableConfigProviderbelongs to (must not be null).value- The (initial) value of the relatedIDecisionVariable(can be null for lazy initialization).state- The initialIAssignmentStateof the relatedIDecisionVariable. In case of null the state will be set toAssignmentState.UNDEFINED.
-
-
Method Details
-
getValue
Description copied from class:VariableConfigProviderReturns the current value of thisIDecisionVariable.- Specified by:
getValuein classVariableConfigProvider- Returns:
- the value (may be null)
-
setValue
Description copied from class:VariableConfigProviderChanges the value (for incremental buildup).- Specified by:
setValuein classVariableConfigProvider- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment state- Throws:
ConfigurationException- in case that the types ofVariableConfigProvider.getDeclaration()andvaluedo not comply
-
getState
Description copied from class:VariableConfigProviderReturns the assignment state of this variable.- Specified by:
getStatein classVariableConfigProvider- Returns:
- the assignment state
-
setState
Description copied from class:VariableConfigProviderSetter for theIAssignmentState, needed byCompoundVariables.- Specified by:
setStatein classVariableConfigProvider- Parameters:
state- The newIAssignmentState, which should be set.
-
isStateChangeAllowed
protected final boolean isStateChangeAllowed()Description copied from class:VariableConfigProviderSpecifies whether the relatedIDecisionVariablecan have its ownIAssignmentState. In case of a nestedIDecisionVariableof aStructuredVariable, this is not supported.- Specified by:
isStateChangeAllowedin classVariableConfigProvider- Returns:
trueif the relatedIDecisionVariablecan have its ownIAssignmentState, otherwisefalse.
-
getDeclaration
Returns the Declaration of the relatedIDecisionVariable.- Specified by:
getDeclarationin classVariableConfigProvider- Returns:
IConfigurationElement.getDeclaration().
-
getConfiguration
Return theConfigurationwhere the relatedIDecisionVariablebelongs to.- Specified by:
getConfigurationin classVariableConfigProvider- Returns:
IConfigurationElement.getConfiguration().
-
setHistoryValue
Description copied from class:VariableConfigProviderChanges the value from value history.- Specified by:
setHistoryValuein classVariableConfigProvider- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment state- Throws:
ConfigurationException- in case that the types ofVariableConfigProvider.getDeclaration()andvaluedo not comply
-
assignValue
private void assignValue(Value value, IAssignmentState state, boolean allowDeletation) throws ConfigurationException Assigns a value. The boolean parameter facilitates a differentiation between assignment of old values and new values. In case of old values, already assigned slots of a compound can be set to null. This must be avoided in case of new values (incremental build up).- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment stateallowDeletation-trueif null values can overwrite already set values of an compound.- Throws:
ConfigurationException- in case that the types ofgetDeclaration()andvaluedo not comply
-
assignCompoundValue
private Value assignCompoundValue(CompoundValue value, IAssignmentState state, boolean allowDeletation, CompoundValue oldValue) throws ConfigurationException Assigns a CompoundValue.- Parameters:
value- the value (may be null for incremental buildup)state- the related assignment stateallowDeletation-trueif null values can overwrite already set values of an compound.oldValue- copy of value.- Returns:
- value
- Throws:
ConfigurationException- in case that the types ofgetDeclaration()andvaluedo not comply
-
assignContainerValue
private Value assignContainerValue(ContainerValue conValue, IAssignmentState state, boolean allowDeletation) throws ConfigurationException Assigns a ContainerValue.- Parameters:
conValue- the value (may be null for incremental buildup)state- the related assignment stateallowDeletation-trueif null values can overwrite already set values of an compound.- Returns:
- value
- Throws:
ConfigurationException- in case that the types ofgetDeclaration()andvaluedo not comply
-
setValueImpl
Changes the value adjustingValue.setValueParent(net.ssehub.easy.varModel.model.values.IValueParent)the parent variable of the involved values).- Parameters:
value- the new value
-
freeze
Description copied from class:VariableConfigProviderCauses to freeze the current value.- Specified by:
freezein classVariableConfigProvider- Parameters:
selector- determines which parts shall be frozen
-