Class Model
- java.lang.Object
-
- net.ssehub.easy.basics.modelManagement.Model
-
- All Implemented Interfaces:
IModel,IModelData
public abstract class Model extends java.lang.Object implements IModel
Represents the type of models to be managed.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ModelImport<?>>importsprivate java.lang.Stringnameprivate Versionversion
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddImport(ModelImport<?> pimport)Adds an import to this model.voiddispose()Shall be called at the end of the lifetime of the model in order to clean up references such as listeners.ModelImport<?>getImport(int index)Returns the model import specified byindex.intgetImportsCount()Returns the number of imports.java.lang.StringgetName()Returns the name of the model element.VersiongetVersion()Returns the version of this model.voidsetVersion(Version version)Changes the version of this model.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.basics.modelManagement.IModel
getIndentationConfiguration, getRestrictionEvaluationContext, getSuper
-
-
-
-
Field Detail
-
version
private Version version
-
imports
private java.util.List<ModelImport<?>> imports
-
name
private java.lang.String name
-
-
Constructor Detail
-
Model
public Model(java.lang.String name)
Creates a model instance.- Parameters:
name- the name of the model
-
Model
public Model(java.lang.String name, Version version)Creates a model instance.- Parameters:
name- the name of the modelversion- the version of the model (may be null if there is none)
-
-
Method Detail
-
setVersion
public void setVersion(Version version)
Changes the version of this model.- Specified by:
setVersionin interfaceIModel- Parameters:
version- Version to set
-
getVersion
public Version getVersion()
Returns the version of this model.- Specified by:
getVersionin interfaceIModel- Specified by:
getVersionin interfaceIModelData- Returns:
- the version or
nullif no version is specified for this model.
-
getName
public java.lang.String getName()
Returns the name of the model element.- Specified by:
getNamein interfaceIModel- Specified by:
getNamein interfaceIModelData- Returns:
- the name of this model element.
-
addImport
public boolean addImport(ModelImport<?> pimport)
Adds an import to this model. Conflicts are added always, imports are checked for duplicates.- Parameters:
pimport- The import- Returns:
trueif the addition was successful,falseelse due to duplicated names
-
getImportsCount
public int getImportsCount()
Returns the number of imports.- Specified by:
getImportsCountin interfaceIModel- Returns:
- the number of imports
-
getImport
public ModelImport<?> getImport(int index)
Returns the model import specified byindex.- Specified by:
getImportin interfaceIModel- Parameters:
index- a 0-based index specifying the import to be returned- Returns:
- the model import
- Throws:
java.lang.IndexOutOfBoundsException- ifindex<0 || index>=getImportsCount()
-
-