Class Model
java.lang.Object
net.ssehub.easy.basics.modelManagement.Model
- All Implemented Interfaces:
IModel,IModelData
Represents the type of models to be managed.
- Author:
- Holger Eichelberger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddImport(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.intReturns the number of imports.longReturns the last modification timestamp.getName()Returns the name of the model element.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, waitMethods inherited from interface net.ssehub.easy.basics.modelManagement.IModel
getIndentationConfiguration, getRestrictionEvaluationContext, getSuper
-
Field Details
-
version
-
imports
-
name
-
timestamp
private long timestamp
-
-
Constructor Details
-
Model
Creates a model instance.- Parameters:
name- the name of the model
-
Model
Creates a model instance.- Parameters:
name- the name of the modelversion- the version of the model (may be null if there is none)
-
-
Method Details
-
setVersion
Changes the version of this model.- Specified by:
setVersionin interfaceIModel- Parameters:
version- Version to set
-
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
Returns the name of the model element.- Specified by:
getNamein interfaceIModel- Specified by:
getNamein interfaceIModelData- Returns:
- the name of this model element.
-
addImport
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
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:
IndexOutOfBoundsException- ifindex<0 || index>=getImportsCount()
-
dispose
public void dispose()Description copied from interface:IModelShall be called at the end of the lifetime of the model in order to clean up references such as listeners. -
getLastModification
public long getLastModification()Description copied from interface:IModelReturns the last modification timestamp.- Specified by:
getLastModificationin interfaceIModel- Returns:
- the last modification timestamp, invalid if
0
-