Class ProjectContainer
- java.lang.Object
-
- net.ssehub.easy.producer.core.varMod.container.ModelContainer<Project>
-
- net.ssehub.easy.producer.core.varMod.container.ProjectContainer
-
- All Implemented Interfaces:
IModelData,IModelListener<Project>
public class ProjectContainer extends ModelContainer<Project>
ModelContainerfor holding a Project and its configuration.- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfig
-
Constructor Summary
Constructors Constructor Description ProjectContainer(Project project, Configuration location)Default constructor for a created of loadedProject.ProjectContainer(Project project, SemanticErrorDescription description, Configuration location)Constructor if an Exception occurred during parsing theProject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationgetConfiguration()Returns the configuration related to the storedProject.java.io.FilegetLocation()Returns the location, where the model is loaded from.voidnotifyReplaced(Project oldProject, Project newProject)Is called to notify thatoldModelis replaced bynewModel.voidsetMainModel(ModelInfo<Project> newMainModel)Changes the managed Model.-
Methods inherited from class net.ssehub.easy.producer.core.varMod.container.ModelContainer
getDescription, getHighestVersion, getLocation, getModel, getName, getVersion, isSaveable, listAvailableModels, registerModelListener, unregisterModelListener
-
-
-
-
Field Detail
-
config
private Configuration config
-
-
Constructor Detail
-
ProjectContainer
public ProjectContainer(Project project, Configuration location)
Default constructor for a created of loadedProject.- Parameters:
project- A valid project, which shall be managed by thisModelContainer.location- The location (folder) of the managed project.
-
ProjectContainer
public ProjectContainer(Project project, SemanticErrorDescription description, Configuration location)
Constructor if an Exception occurred during parsing theProject. TheProjectcan be used but not be saved, as long the semantic error is not solved.- Parameters:
project- TheProject, which should be managed by this container.description- description A description of an occurred semantic error while parsing theProject. Can be null, then this constructor has the same behavior as#ProjectContainer(Project).location- The location (folder) of the managed project.
-
-
Method Detail
-
notifyReplaced
public void notifyReplaced(Project oldProject, Project newProject)
Is called to notify thatoldModelis replaced bynewModel. The listener registrations foroldModelwill be adjusted accordingly.
Do not modify the the listeners ofoldModelornewModelduring this method. If this method is called, the storedModelContainer.getDescription()will be set to null as this is usually only called if the parser has parsed the model successfully.- Specified by:
notifyReplacedin interfaceIModelListener<Project>- Overrides:
notifyReplacedin classModelContainer<Project>- Parameters:
oldProject- the old model being replacednewProject- the new model (the replacement)
-
getConfiguration
public Configuration getConfiguration()
Returns the configuration related to the storedProject.- Returns:
- the configuration related to the stored
Project. - See Also:
ModelContainer.getModel()
-
setMainModel
public void setMainModel(ModelInfo<Project> newMainModel)
Description copied from class:ModelContainerChanges the managed Model. The model should be add the specified location (ModelContainer.getLocation().- Overrides:
setMainModelin classModelContainer<Project>- Parameters:
newMainModel- The model that should be used by this container.- See Also:
ModelContainer.listAvailableModels()
-
getLocation
public java.io.File getLocation()
Description copied from class:ModelContainerReturns the location, where the model is loaded from.- Specified by:
getLocationin classModelContainer<Project>- Returns:
- The location of the loaded model.
-
-