Class ScriptContainer

  • All Implemented Interfaces:
    net.ssehub.easy.basics.modelManagement.IModelData, net.ssehub.easy.basics.modelManagement.IModelListener<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>

    public class ScriptContainer
    extends ModelContainer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
    ModelContainer for holding a build Script.
    Author:
    El-Sharkawy
    • Field Detail

      • wasEdited

        private boolean wasEdited
        Specification whether this script was edited inside of easy.
        • true: Was edited in EASy and should be saved
        • false: Should not be saved
    • Constructor Detail

      • ScriptContainer

        public ScriptContainer​(net.ssehub.easy.instantiation.core.model.buildlangModel.Script script,
                               Configuration location)
        Default constructor for a created of loaded Script.
        Parameters:
        script - A valid Script, which shall be managed by this ModelContainer.
        location - The location (folder) of the managed build Script.
      • ScriptContainer

        public ScriptContainer​(net.ssehub.easy.instantiation.core.model.buildlangModel.Script script,
                               SemanticErrorDescription description,
                               Configuration location)
        Constructor if an Exception occurred during parsing the Script. The Script can be used but not be saved, as long the semantic error is not solved.
        Parameters:
        script - The Script, which should be managed by this container.
        description - A description of an occurred semantic error while parsing the Script. Can be null, then this constructor has the same behavior as #ScriptContainer(Script).
        location - The location (folder) of the managed build Script.
      • ScriptContainer

        public ScriptContainer​(net.ssehub.easy.instantiation.core.model.buildlangModel.Script script,
                               SemanticErrorDescription description,
                               Configuration location,
                               boolean newlyCreated)
        Constructor if a Script was created inside of EASy (not via a XTextEditor).
        Parameters:
        script - The Script, which should be managed by this container.
        description - A description of an occurred semantic error while parsing the Script. Can be null, then this constructor has the same behavior as #ScriptContainer(Script).
        location - The location (folder) of the managed build Script.
        newlyCreated - true If the script was edited/created inside of EASy and shall be saved when the whole project is saved, false ohterwise.
    • Method Detail

      • isTransformable

        public boolean isTransformable()
        Checks whether VIL instantiation should be possible. Currently, we check whether there is a start rule (main-rule matching the script parameters) which either has a body or some kind of precondition or some kind of postcondition.
        Returns:
        true if instantiation should be possible, false else
      • getLocation

        public java.io.File getLocation()
        Description copied from class: ModelContainer
        Returns the location, where the model is loaded from.
        Specified by:
        getLocation in class ModelContainer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
        Returns:
        The location of the loaded model.
      • isSaveable

        public boolean isSaveable()
        Description copied from class: ModelContainer
        Checks whether the model works and can be saved, or if a dummy was used to avoid NullPointerExceptions.
        Overrides:
        isSaveable in class ModelContainer<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
        Returns:
        true if a loaded model is used and can be saved, false if a dummy was used, which should not be saved.
      • wasEdited

        private boolean wasEdited()
        Returns whether this script was edited in EASy and should be saved.
        Returns:
        true should be saved (will also overwrite existing files and delete (not parsed) comments).
      • setEdited

        public void setEdited​(boolean wasEdited)
        Specification whether this file was edited in EASy.
        Parameters:
        wasEdited - true should be saved (will also overwrite existing files and delete (not parsed) comments).