Class QualiMasterConfigurationSaver
java.lang.Object
net.ssehub.easy.varModel.confModel.ConfigurationSaver
eu.qualimaster.easy.extension.modelop.QualiMasterConfigurationSaver
- Direct Known Subclasses:
QmPrunedConfigSaver
public class QualiMasterConfigurationSaver
extends net.ssehub.easy.varModel.confModel.ConfigurationSaver
Specializes the default configuration saver. Create an instance and call
ConfigurationSaver.getSavedConfiguration()
for writing via IVMLWriter.- Author:
- Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<net.ssehub.easy.varModel.model.AbstractVariable, net.ssehub.easy.varModel.model.AbstractVariable> -
Constructor Summary
ConstructorsModifierConstructorDescriptionQualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) Creates a configuration saver instance.protectedQualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration, boolean ownProject, boolean onlyUserInput) Creates a configuration saver instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddImports(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) protected voidaddLocalVariables(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) protected net.ssehub.easy.varModel.cst.ConstraintSyntaxTreecreateAssignmentConstraint(net.ssehub.easy.varModel.model.Project dstProject, net.ssehub.easy.varModel.model.AbstractVariable decl, net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.values.Value value) protected net.ssehub.easy.varModel.model.FreezeBlockcreateFreezeBlock(net.ssehub.easy.varModel.model.IFreezable[] freezables, net.ssehub.easy.varModel.model.Project parent) private net.ssehub.easy.varModel.cst.ConstraintSyntaxTreecreateIndexAccess(net.ssehub.easy.varModel.model.DecisionVariableDeclaration decl, net.ssehub.easy.varModel.model.values.Value containerValue, net.ssehub.easy.varModel.model.values.Value value) Tries to create an index access forvaluewithincontainerValue.protected net.ssehub.easy.varModel.model.ProjectcreateProject(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) Creates the project to store the configuration into.protected booleanisSavingEnabled(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.IDecisionVariable var) private voidlazyInit()Initializes attributes lazily due to work in constructor.protected voidsaveFreezeStates(net.ssehub.easy.varModel.model.Project confProject) private net.ssehub.easy.varModel.cst.ConstraintSyntaxTreesearchSequenceValue(net.ssehub.easy.varModel.model.Project project, net.ssehub.easy.varModel.model.values.Value value, net.ssehub.easy.varModel.confModel.Configuration config) Searches the givenprojectfor a sequence that containsvalueand returns the sequence index access expression if successful.private net.ssehub.easy.varModel.cst.ConstraintSyntaxTreesearchSequenceValue(net.ssehub.easy.varModel.model.Project project, net.ssehub.easy.varModel.model.values.Value value, net.ssehub.easy.varModel.confModel.Configuration config, Set<Object> done) Searches the givenprojectfor a sequence that containsvalueand returns the sequence index access expression if successful.Methods inherited from class net.ssehub.easy.varModel.confModel.ConfigurationSaver
addAttributes, addVersion, deriveOperand, getConfiguration, getSavedConfiguration, toSaveableValue
-
Field Details
-
varMapping
private Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.model.AbstractVariable> varMapping
-
-
Constructor Details
-
QualiMasterConfigurationSaver
public QualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) throws net.ssehub.easy.varModel.confModel.ConfigurationException Creates a configuration saver instance.- Parameters:
srcConfiguration- The configuration which should be saved.- Throws:
net.ssehub.easy.varModel.confModel.ConfigurationException- in case of any configuration errors
-
QualiMasterConfigurationSaver
protected QualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration, boolean ownProject, boolean onlyUserInput) throws net.ssehub.easy.varModel.confModel.ConfigurationException Creates a configuration saver instance.- Parameters:
srcConfiguration- The configuration which should be saved.ownProject- return an own project (true) or add the configuration toConfiguration.getProject()(false)onlyUserInput- Specifies whether only user Input should be stored:true:Assignments in stateAssignmentState.ASSIGNEDandAssignmentState.FROZENwill be saved.false: Assignments in stateAssignmentState.ASSIGNED,AssignmentState.FROZEN, andAssignmentState.DERIVEDwill be saved (i.e. also computed values).
- Throws:
net.ssehub.easy.varModel.confModel.ConfigurationException- in case of any configuration errors
-
-
Method Details
-
lazyInit
private void lazyInit()Initializes attributes lazily due to work in constructor. -
createProject
protected net.ssehub.easy.varModel.model.Project createProject(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) Creates the project to store the configuration into.- Overrides:
createProjectin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver- Parameters:
srcConfiguration- the configuration to be stored- Returns:
- the project to store the configuration into
-
addLocalVariables
protected void addLocalVariables(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) - Overrides:
addLocalVariablesin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-
createIndexAccess
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createIndexAccess(net.ssehub.easy.varModel.model.DecisionVariableDeclaration decl, net.ssehub.easy.varModel.model.values.Value containerValue, net.ssehub.easy.varModel.model.values.Value value) Tries to create an index access forvaluewithincontainerValue.- Parameters:
decl- the container variable declaration (must matchcontainerValue)containerValue- the container value to accessvalue- the value to search for withincontainerValue- Returns:
- the container access expression if the
valuecan be found incontainerValueand the access expression can be created, null else
-
searchSequenceValue
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree searchSequenceValue(net.ssehub.easy.varModel.model.Project project, net.ssehub.easy.varModel.model.values.Value value, net.ssehub.easy.varModel.confModel.Configuration config) Searches the givenprojectfor a sequence that containsvalueand returns the sequence index access expression if successful.- Parameters:
project- the project to start searchingvalue- the value to be used as referenceconfig- the actual configuration- Returns:
- the access expression or null if none can be created
-
searchSequenceValue
private net.ssehub.easy.varModel.cst.ConstraintSyntaxTree searchSequenceValue(net.ssehub.easy.varModel.model.Project project, net.ssehub.easy.varModel.model.values.Value value, net.ssehub.easy.varModel.confModel.Configuration config, Set<Object> done) Searches the givenprojectfor a sequence that containsvalueand returns the sequence index access expression if successful. This method shall not be called directly. UsesearchSequenceValue(Project, Value, Configuration)instead.- Parameters:
project- the project to start searchingvalue- the value to be used as referenceconfig- the actual configurationdone- all the projects that have been searched so far- Returns:
- the access expression or null if none can be created
-
createAssignmentConstraint
protected net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createAssignmentConstraint(net.ssehub.easy.varModel.model.Project dstProject, net.ssehub.easy.varModel.model.AbstractVariable decl, net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.values.Value value) - Overrides:
createAssignmentConstraintin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-
addImports
protected void addImports(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration) - Overrides:
addImportsin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-
isSavingEnabled
protected boolean isSavingEnabled(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.IDecisionVariable var) - Overrides:
isSavingEnabledin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-
createFreezeBlock
protected net.ssehub.easy.varModel.model.FreezeBlock createFreezeBlock(net.ssehub.easy.varModel.model.IFreezable[] freezables, net.ssehub.easy.varModel.model.Project parent) - Overrides:
createFreezeBlockin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-
saveFreezeStates
protected void saveFreezeStates(net.ssehub.easy.varModel.model.Project confProject) - Overrides:
saveFreezeStatesin classnet.ssehub.easy.varModel.confModel.ConfigurationSaver
-