Class ConfigurationSaver


  • public class ConfigurationSaver
    extends java.lang.Object
    This method is part of the configuration and responsible for saving the values of the configuration inside the Configuration.toProject(boolean) method. The visibility of this class has been relaxed in order to serve as basis for refinements.
    Author:
    El-Sharkawy, Holger Eichelberger
    • Method Detail

      • getConfiguration

        protected Configuration getConfiguration()
        Returns the Configuration, which will currently saved by this saver.
        Returns:
        The configuration to be saved.
      • createProject

        protected Project createProject​(Configuration srcConfiguration)
        Creates the project to store the configuration into.
        Parameters:
        srcConfiguration - the configuration to be stored
        Returns:
        the project to store the configuration into
      • addVersion

        protected void addVersion​(Project destProject,
                                  Configuration srcConfiguration)
        Adds the current version to destProject.
        Parameters:
        destProject - the destination project being set up
        srcConfiguration - the source configuration
      • addImports

        protected void addImports​(Project destProject,
                                  Configuration srcConfiguration)
        Adds the imports to destProject.
        Parameters:
        destProject - the destination project being set up
        srcConfiguration - the source configuration
      • addLocalVariables

        protected void addLocalVariables​(Project destProject,
                                         Configuration srcConfiguration)
        Adds local variables to destProject.
        Parameters:
        destProject - the destination project being set up
        srcConfiguration - the source configuration
      • addAttributes

        protected void addAttributes​(Project destProject,
                                     Configuration srcConfiguration)
        Adds attributes to destProject.
        Parameters:
        destProject - the destination project being set up
        srcConfiguration - the source configuration
      • createAssignmentConstraint

        protected ConstraintSyntaxTree createAssignmentConstraint​(Project dstProject,
                                                                  AbstractVariable decl,
                                                                  IDecisionVariable var,
                                                                  Value value)
        Creates an assignment constraint.
        Parameters:
        dstProject - the destination project
        decl - the variable declaration
        var - the configuration variable itself
        value - the value assigned to decl
        Returns:
        the created constraint
      • isSavingEnabled

        protected boolean isSavingEnabled​(Project destProject,
                                          IDecisionVariable var)
        Returns whether saving this variable (for the destination project destProject) is enabled.
        Parameters:
        destProject - the project being saved
        var - the variable to be checked
        Returns:
        true if saving for var is enabled, false else
      • removedLocalConfigChanges

        private void removedLocalConfigChanges()
        Part of the Configuration.toProject(boolean) method. Removes all local configuration settings of the current project, before current configuration can be merged into the project.
      • processAssignment

        private int processAssignment​(Project confProject,
                                      java.lang.StringBuilder errors,
                                      AbstractVariable decl,
                                      IDecisionVariable var,
                                      Value value)
        Processes an assignment.
        Parameters:
        confProject - the project to be modified as a side effect
        errors - the errors collected so far
        decl - the variable declaration
        var - the configuration variable itself
        value - the value assigned to decl
        Returns:
        the new value of code
      • deriveOperand

        protected ConstraintSyntaxTree deriveOperand​(AbstractVariable decl,
                                                     IDecisionVariable var)
        Derives the operand expression for turning a configuration into a project.
        Parameters:
        decl - the variable declaration to start at
        var - the related decision variable
        Returns:
        the constraint syntax tree representing the operand for an assignment
      • checkState

        private boolean checkState​(IAssignmentState state)
        Checks whether the sate (of a variable) should be saved.
        Parameters:
        state - The sate of the current variable to be saved.
        Returns:
        true if the sate should be saved, false otherwise.
      • createFreezeBlock

        protected FreezeBlock createFreezeBlock​(IFreezable[] freezables,
                                                Project parent)
        Creates a freeze block, allowing customization (factory method).
        Parameters:
        freezables - the freezables
        parent - the parent of the freeze block
        Returns:
        the freeze block