Class ScriptContainer
- java.lang.Object
-
- net.ssehub.easy.producer.core.varMod.container.ModelContainer<Script>
-
- net.ssehub.easy.producer.core.varMod.container.ScriptContainer
-
- All Implemented Interfaces:
IModelData,IModelListener<Script>
public class ScriptContainer extends ModelContainer<Script>
ModelContainerfor holding a buildScript.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private booleanwasEditedSpecification whether this script was edited inside of easy.
-
Constructor Summary
Constructors Constructor Description ScriptContainer(Script script, Configuration location)Default constructor for a created of loadedScript.ScriptContainer(Script script, SemanticErrorDescription description, Configuration location)Constructor if an Exception occurred during parsing theScript.ScriptContainer(Script script, SemanticErrorDescription description, Configuration location, boolean newlyCreated)Constructor if aScriptwas created inside of EASy (not via a XTextEditor).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetLocation()Returns the location, where the model is loaded from.booleanisSaveable()Checks whether the model works and can be saved, or if a dummy was used to avoidNullPointerExceptions.booleanisTransformable()Checks whether VIL instantiation should be possible.voidsetEdited(boolean wasEdited)Specification whether this file was edited in EASy.private booleanwasEdited()Returns whether this script was edited in EASy and should be saved.-
Methods inherited from class net.ssehub.easy.producer.core.varMod.container.ModelContainer
getDescription, getHighestVersion, getLocation, getModel, getName, getVersion, listAvailableModels, notifyReplaced, registerModelListener, setMainModel, unregisterModelListener
-
-
-
-
Constructor Detail
-
ScriptContainer
public ScriptContainer(Script script, Configuration location)
Default constructor for a created of loadedScript.- Parameters:
script- A validScript, which shall be managed by thisModelContainer.location- The location (folder) of the managed buildScript.
-
ScriptContainer
public ScriptContainer(Script script, SemanticErrorDescription description, Configuration location)
Constructor if an Exception occurred during parsing theScript. TheScriptcan be used but not be saved, as long the semantic error is not solved.- Parameters:
script- TheScript, which should be managed by this container.description- A description of an occurred semantic error while parsing theScript. Can be null, then this constructor has the same behavior as#ScriptContainer(Script).location- The location (folder) of the managed buildScript.
-
ScriptContainer
public ScriptContainer(Script script, SemanticErrorDescription description, Configuration location, boolean newlyCreated)
Constructor if aScriptwas created inside of EASy (not via a XTextEditor).- Parameters:
script- TheScript, which should be managed by this container.description- A description of an occurred semantic error while parsing theScript. Can be null, then this constructor has the same behavior as#ScriptContainer(Script).location- The location (folder) of the managed buildScript.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:
trueif instantiation should be possible,falseelse
-
getLocation
public java.io.File getLocation()
Description copied from class:ModelContainerReturns the location, where the model is loaded from.- Specified by:
getLocationin classModelContainer<Script>- Returns:
- The location of the loaded model.
-
isSaveable
public boolean isSaveable()
Description copied from class:ModelContainerChecks whether the model works and can be saved, or if a dummy was used to avoidNullPointerExceptions.- Overrides:
isSaveablein classModelContainer<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).
-
-