Class TemplateModel

  • All Implemented Interfaces:
    IModel

    public final class TemplateModel
    extends Object
    implements IModel
    Since:
    3.0.0
    Author:
    Daniel Fernández
    • Method Detail

      • getTemplateData

        public final TemplateData getTemplateData()
      • getConfiguration

        public final IEngineConfiguration getConfiguration()
        Description copied from interface: IModel

        Returns the engine configuration that was used for creating this model.

        Specified by:
        getConfiguration in interface IModel
        Returns:
        the engine configuration.
      • getTemplateMode

        public final TemplateMode getTemplateMode()
        Description copied from interface: IModel

        Returns the template mode used for creating this model.

        Specified by:
        getTemplateMode in interface IModel
        Returns:
        the template mode.
      • size

        public final int size()
        Description copied from interface: IModel

        The size of the model (number of ITemplateEvent objects contained).

        Specified by:
        size in interface IModel
        Returns:
        the size of the model.
      • get

        public final ITemplateEvent get​(int pos)
        Description copied from interface: IModel

        Retrieves a specific event from the model sequence.

        Specified by:
        get in interface IModel
        Parameters:
        pos - the position (zero-based) of the event to be retrieved.
        Returns:
        the retrieved event.
      • add

        public final void add​(ITemplateEvent event)
        Description copied from interface: IModel

        Adds an event at the end of the sequence.

        Specified by:
        add in interface IModel
        Parameters:
        event - the event to be added.
      • insert

        public final void insert​(int pos,
                                 ITemplateEvent event)
        Description copied from interface: IModel

        Inserts an event into a specific position in the sequence.

        Specified by:
        insert in interface IModel
        Parameters:
        pos - the position to insert the event (zero-based).
        event - the event to be inserted.
      • replace

        public final void replace​(int pos,
                                  ITemplateEvent event)
        Description copied from interface: IModel

        Replaces the event at the specified position with the one passed as argument.

        Specified by:
        replace in interface IModel
        Parameters:
        pos - the position of the event to be replaced (zero-based).
        event - the event to serve as replacement.
      • addModel

        public final void addModel​(IModel model)
        Description copied from interface: IModel

        Add an entire model at the end of the sequence. This effectively appends the model argument's sequence to this one.

        Specified by:
        addModel in interface IModel
        Parameters:
        model - the model to be appended.
      • insertModel

        public final void insertModel​(int pos,
                                      IModel model)
        Description copied from interface: IModel

        Inserts an entire model into a specific position in this model's sequence.

        Specified by:
        insertModel in interface IModel
        Parameters:
        pos - the position to insert the mdoel (zero-based).
        model - the model to be inserted.
      • remove

        public final void remove​(int pos)
        Description copied from interface: IModel

        Remove an event from the sequence.

        Specified by:
        remove in interface IModel
        Parameters:
        pos - the position (zero-based) of the event to be removed.
      • reset

        public final void reset()
        Description copied from interface: IModel

        Remove all events from the model sequence.

        Specified by:
        reset in interface IModel
      • cloneModel

        public final IModel cloneModel()
        Description copied from interface: IModel

        Clones the model and all its events.

        Specified by:
        cloneModel in interface IModel
        Returns:
        the new model.
      • write

        public final void write​(Writer writer)
                         throws IOException
        Description copied from interface: IModel

        Write this model (its events) through the specified writer.

        Specified by:
        write in interface IModel
        Parameters:
        writer - the writer that will be used for writing the model.
        Throws:
        IOException - should any exception happen.
      • accept

        public void accept​(IModelVisitor visitor)
        Description copied from interface: IModel

        Accept a visitor implementing IModelVisitor. This visitor will be executed for each event in the sequence.

        Specified by:
        accept in interface IModel
        Parameters:
        visitor - the visitor object.