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

    Fields
    Modifier and Type
    Field
    Description
    private Map<net.ssehub.easy.varModel.model.AbstractVariable,net.ssehub.easy.varModel.model.AbstractVariable>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    QualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration)
    Creates a configuration saver instance.
    protected
    QualiMasterConfigurationSaver(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration, boolean ownProject, boolean onlyUserInput)
    Creates a configuration saver instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addImports(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration)
     
    protected void
    addLocalVariables(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration)
     
    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)
     
    protected net.ssehub.easy.varModel.model.FreezeBlock
    createFreezeBlock(net.ssehub.easy.varModel.model.IFreezable[] freezables, net.ssehub.easy.varModel.model.Project parent)
     
    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 for value within containerValue.
    protected net.ssehub.easy.varModel.model.Project
    createProject(net.ssehub.easy.varModel.confModel.Configuration srcConfiguration)
    Creates the project to store the configuration into.
    protected boolean
    isSavingEnabled(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.IDecisionVariable var)
     
    private void
    Initializes attributes lazily due to work in constructor.
    protected void
    saveFreezeStates(net.ssehub.easy.varModel.model.Project confProject)
     
    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 given project for a sequence that contains value and returns the sequence index access expression if successful.
    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 given project for a sequence that contains value and returns the sequence index access expression if successful.

    Methods inherited from class net.ssehub.easy.varModel.confModel.ConfigurationSaver

    addAttributes, addVersion, deriveOperand, getConfiguration, getSavedConfiguration, toSaveableValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 to Configuration.getProject() (false)
      onlyUserInput - Specifies whether only user Input should be stored:
      • true: Assignments in state AssignmentState.ASSIGNED and AssignmentState.FROZEN will be saved.
      • false: Assignments in state AssignmentState.ASSIGNED, AssignmentState.FROZEN, and AssignmentState.DERIVED will 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:
      createProject in class net.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:
      addLocalVariables in class net.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 for value within containerValue.
      Parameters:
      decl - the container variable declaration (must match containerValue)
      containerValue - the container value to access
      value - the value to search for within containerValue
      Returns:
      the container access expression if the value can be found in containerValue and 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 given project for a sequence that contains value and returns the sequence index access expression if successful.
      Parameters:
      project - the project to start searching
      value - the value to be used as reference
      config - 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 given project for a sequence that contains value and returns the sequence index access expression if successful. This method shall not be called directly. Use searchSequenceValue(Project, Value, Configuration) instead.
      Parameters:
      project - the project to start searching
      value - the value to be used as reference
      config - the actual configuration
      done - 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:
      createAssignmentConstraint in class net.ssehub.easy.varModel.confModel.ConfigurationSaver
    • addImports

      protected void addImports(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.Configuration srcConfiguration)
      Overrides:
      addImports in class net.ssehub.easy.varModel.confModel.ConfigurationSaver
    • isSavingEnabled

      protected boolean isSavingEnabled(net.ssehub.easy.varModel.model.Project destProject, net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Overrides:
      isSavingEnabled in class net.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:
      createFreezeBlock in class net.ssehub.easy.varModel.confModel.ConfigurationSaver
    • saveFreezeStates

      protected void saveFreezeStates(net.ssehub.easy.varModel.model.Project confProject)
      Overrides:
      saveFreezeStates in class net.ssehub.easy.varModel.confModel.ConfigurationSaver