Class AttributeValuesPage.TemporaryAttributesConfiguration
- java.lang.Object
-
- net.ssehub.easy.varModel.confModel.Configuration
-
- net.ssehub.easy.producer.ui.productline_editor.configuration.AttributeValuesPage.TemporaryAttributesConfiguration
-
- All Implemented Interfaces:
java.lang.Iterable<IDecisionVariable>,IModelListener<Project>,IConfiguration,IConfigurationElement,IConfigurationVisitable,IProjectListener
- Enclosing class:
- AttributeValuesPage
private class AttributeValuesPage.TemporaryAttributesConfiguration extends Configuration
Represents a temporary configuration for defining attribute values and acts as a controller for the model-level modifications.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private booleangroupprivate AttributeValuesvalues
-
Constructor Summary
Constructors Constructor Description TemporaryAttributesConfiguration(Project project, AttributeValues values, boolean group)Creates a new configuration for the given project.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddAttribute(Attribute attribute)Adds the given attribute and its values to this configuration.voidaddAttributeDecision(Attribute attribute, Value value)Adds an attribute decision to this configuration.voidclear()Clears all decisions.booleanconvert(boolean group)Converts values to a group or non-group attribute values configuration.private booleanconvert(boolean group, boolean force)Converts values to a group or non-group attribute values configuration.voidrefreshed(Configuration config)In case that the configuration was refreshed.booleanremoveDecision(IDecisionVariable variable)Remove a specific decision.private booleansameGroup(Attribute attr1, Attribute attr2)Returns whether two given attributes are in the same group, i.e.voidvalueChanged(IDecisionVariable changedVariable, Value oldValue)To be called when a value changed.-
Methods inherited from class net.ssehub.easy.varModel.confModel.Configuration
accept, addAttributeDecision, createDecision, dereference, dereference, equalsByInstanceName, findInParents, freeze, freeze, freezeValues, getAllInstances, getConfiguration, getDecision, getDecision, getDecisionCount, getDeclaration, getInstanceName, getInstanceName, getName, getNestedElement, getParent, getProject, getQueryCache, getResolutionState, getState, getTopLevelDecision, isApproximatelyFrozen, isNested, iterator, mapVariable, notifyReplaced, printConfig, prune, refresh, register, removeDerivedValues, setValue, shareQueryCacheWith, toProject, toProject, unfreeze, unregister, wasCreated
-
-
-
-
Field Detail
-
values
private AttributeValues values
-
group
private boolean group
-
-
Constructor Detail
-
TemporaryAttributesConfiguration
public TemporaryAttributesConfiguration(Project project, AttributeValues values, boolean group)
Creates a new configuration for the given project.
Please take a look in VarModel#addProject(Project) for more information.- Parameters:
project- The project, where this configuration belongs to. This project should already be registered at the VarModelvalues- the attributes with valuesgroup- group the attributes
-
-
Method Detail
-
convert
private boolean convert(boolean group, boolean force)Converts values to a group or non-group attribute values configuration. Converting to a grouped configuration may imply data loss.- Parameters:
group- convert to a group or non-group configurationforce- the execution (initial call)- Returns:
trueif the conversion was done,falseelse
-
addAttribute
private void addAttribute(Attribute attribute)
Adds the given attribute and its values to this configuration.- Parameters:
attribute- the attribute to add
-
convert
public boolean convert(boolean group)
Converts values to a group or non-group attribute values configuration. Converting to a grouped configuration may imply data loss.- Parameters:
group- convert to a group or non-group configuration- Returns:
trueif the conversion was done,falseelse
-
sameGroup
private boolean sameGroup(Attribute attr1, Attribute attr2)
Returns whether two given attributes are in the same group, i.e. same (non-qualified) name and same type.- Parameters:
attr1- the first attributeattr2- the same attribute- Returns:
trueifattr1andattr2are in the same group,falseelse
-
addAttributeDecision
public void addAttributeDecision(Attribute attribute, Value value) throws ConfigurationException
Adds an attribute decision to this configuration. This method is a specific functionality for user interaction. Subclass this class and make it accessible if needed, otherwise it may break the value protection provided by this class.- Parameters:
attribute- the attribute for which the decision shall be createdvalue- the value of the attribute (may be null)- Throws:
ConfigurationException- in case of type conflicts
-
clear
public void clear()
Clears all decisions.- Overrides:
clearin classConfiguration
-
removeDecision
public boolean removeDecision(IDecisionVariable variable)
Remove a specific decision.- Overrides:
removeDecisionin classConfiguration- Parameters:
variable- the decision to be removed- Returns:
trueif this operation was successful,falseelse
-
refreshed
public void refreshed(Configuration config)
In case that the configuration was refreshed.- Parameters:
config- the new configuration
-
valueChanged
public void valueChanged(IDecisionVariable changedVariable, Value oldValue)
To be called when a value changed.- Parameters:
changedVariable- the changed variable carrying the new valueoldValue- the old value
-
-