Class 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 Detail

      • 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 model
        version - 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:
        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 java.lang.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:
        java.lang.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