java.lang.Object
net.ssehub.easy.basics.modelManagement.Model
All Implemented Interfaces:
IModel, IModelData

public abstract class Model extends Object implements IModel
Represents the type of models to be managed.
Author:
Holger Eichelberger
  • Field Details

    • version

      private Version version
    • imports

      private List<ModelImport<?>> imports
    • name

      private String name
    • timestamp

      private long timestamp
  • Constructor Details

    • Model

      public Model(String name)
      Creates a model instance.
      Parameters:
      name - the name of the model
    • Model

      public Model(String name, Version version)
      Creates a model instance.
      Parameters:
      name - the name of the model
      version - the version of the model (may be null if there is none)
  • Method Details

    • setVersion

      public void setVersion(Version version)
      Changes the version of this model.
      Specified by:
      setVersion in interface IModel
      Parameters:
      version - Version to set
    • getVersion

      public Version getVersion()
      Returns the version of this model.
      Specified by:
      getVersion in interface IModel
      Specified by:
      getVersion in interface IModelData
      Returns:
      the version or null if no version is specified for this model.
    • getName

      public String getName()
      Returns the name of the model element.
      Specified by:
      getName in interface IModel
      Specified by:
      getName in interface IModelData
      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:
      true if the addition was successful, false else due to duplicated names
    • getImportsCount

      public int getImportsCount()
      Returns the number of imports.
      Specified by:
      getImportsCount in interface IModel
      Returns:
      the number of imports
    • getImport

      public ModelImport<?> getImport(int index)
      Returns the model import specified by index.
      Specified by:
      getImport in interface IModel
      Parameters:
      index - a 0-based index specifying the import to be returned
      Returns:
      the model import
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getImportsCount()
    • dispose

      public void dispose()
      Description copied from interface: IModel
      Shall be called at the end of the lifetime of the model in order to clean up references such as listeners.
      Specified by:
      dispose in interface IModel
    • getLastModification

      public long getLastModification()
      Description copied from interface: IModel
      Returns the last modification timestamp.
      Specified by:
      getLastModification in interface IModel
      Returns:
      the last modification timestamp, invalid if 0