Class ToplevelVarConfigProvider
- java.lang.Object
-
- net.ssehub.easy.varModel.confModel.VariableConfigProvider
-
- net.ssehub.easy.varModel.confModel.ToplevelVarConfigProvider
-
class ToplevelVarConfigProvider extends VariableConfigProvider
VariableConfigProviderfor not nested variables.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private static EASyLoggerFactory.EASyLoggerLOGGERprivate IDecisionVariablerelatedVariableprivate IAssignmentStatestateprivate Valuevalue
-
Constructor Summary
Constructors Modifier Constructor Description protectedToplevelVarConfigProvider(IDecisionVariable relatedVariable, Value value, IAssignmentState state)Sole constructor for creating aVariableConfigProviderfor a toplevelIDecisionVariable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private 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 ConfigurationgetConfiguration()Return theConfigurationwhere the relatedIDecisionVariablebelongs to.protected AbstractVariablegetDeclaration()Returns the Declaration of the relatedIDecisionVariable.protected IAssignmentStategetState()Returns the assignment state of this variable.protected ValuegetValue()Returns the current value of thisIDecisionVariable.protected booleanisStateChangeAllowed()Specifies whether the relatedIDecisionVariablecan have its ownIAssignmentState.protected voidsetHistoryValue(Value value, IAssignmentState state)Changes the value from value history.protected 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 adjustingthe parent variable of the involved values).-
Methods inherited from class net.ssehub.easy.varModel.confModel.VariableConfigProvider
freeze, unfreeze
-
-
-
-
Field Detail
-
LOGGER
private static final EASyLoggerFactory.EASyLogger LOGGER
-
value
private Value value
-
state
private IAssignmentState state
-
relatedVariable
private IDecisionVariable relatedVariable
-
-
Constructor Detail
-
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 Detail
-
getValue
protected Value getValue()
Description copied from class:VariableConfigProviderReturns the current value of thisIDecisionVariable.- Specified by:
getValuein classVariableConfigProvider- Returns:
- the value (may be null)
-
setValue
protected void setValue(Value value, IAssignmentState state) throws ConfigurationException
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
protected IAssignmentState getState()
Description copied from class:VariableConfigProviderReturns the assignment state of this variable.- Specified by:
getStatein classVariableConfigProvider- Returns:
- the assignment state
-
setState
protected final void setState(IAssignmentState state)
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:
- true if the related
IDecisionVariablecan have its ownIAssignmentState, otherwise false.
-
getDeclaration
protected final AbstractVariable getDeclaration()
Returns the Declaration of the relatedIDecisionVariable.- Specified by:
getDeclarationin classVariableConfigProvider- Returns:
IConfigurationElement.getDeclaration().
-
getConfiguration
protected final Configuration getConfiguration()
Return theConfigurationwhere the relatedIDecisionVariablebelongs to.- Specified by:
getConfigurationin classVariableConfigProvider- Returns:
IConfigurationElement.getConfiguration().
-
setHistoryValue
protected void setHistoryValue(Value value, IAssignmentState state) throws ConfigurationException
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- true if 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- true if 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- true if null values can overwrite already set values of an compound.- Returns:
- value
- Throws:
ConfigurationException- in case that the types ofgetDeclaration()andvaluedo not comply
-
setValueImpl
private void setValueImpl(Value value)
Changes the value adjustingthe parent variable of the involved values).- Parameters:
value- the new value
-
freeze
protected void freeze(IFreezeSelector selector)
Description copied from class:VariableConfigProviderCauses to freeze the current value.- Specified by:
freezein classVariableConfigProvider- Parameters:
selector- determines which parts shall be frozen
-
-