Class TranslationResult<R>

java.lang.Object
net.ssehub.easy.dslCore.TranslationResult<R>
Type Parameters:
R - the top-level result model class

public class TranslationResult<R> extends Object
Represents the result of a translation.
Author:
Holger Eichelberger
  • Field Details

    • receiver

      private MessageReceiver receiver
      Stores an instance which provides access to the messages which occurred during the model translation.
    • results

      private List<R> results
      Stores the created language units / models.
  • Constructor Details

    • TranslationResult

      public TranslationResult()
      Creates an empty instance of this class, e.g., to be used as a dummy translation result without real messages / results.
    • TranslationResult

      public TranslationResult(List<R> results, MessageReceiver receiver)
      Creates an instance of this class.
      Parameters:
      results - the resulting language units (pass in only instances created for this result)
      receiver - the message receiver providing access to translation messages (may be null)
  • Method Details

    • getMessageCount

      public int getMessageCount()
      Returns the number of messages.
      Returns:
      the number of messages
    • getErrorCount

      public int getErrorCount()
      Returns the number of errors among the messages.
      Returns:
      the number of errors
    • getMessage

      public Message getMessage(int index)
      Returns the specified message.
      Parameters:
      index - the position of the message to be returned
      Returns:
      the specified message
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getMessageCount()
    • getReceiver

      public MessageReceiver getReceiver()
      Returns the message receiver.
      Returns:
      the receiver
    • getMessageList

      public List<net.ssehub.easy.basics.messages.IMessage> getMessageList()
      Returns the list of messages (using the more common type).
      Returns:
      the list of messages
    • getMessageListSpecific

      public List<Message> getMessageListSpecific()
      Returns the list of messages.
      Returns:
      the list of messages
    • getResultCount

      public int getResultCount()
      Returns the number of projects being part of the result.
      Returns:
      the number of projects
    • getResult

      public R getResult(int index)
      Returns the specified result.
      Parameters:
      index - the index of the result to be returned
      Returns:
      the specified project
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getResultCount()
    • getResultsList

      public List<R> getResultsList()
      Returns a copy of the list of projects.
      Returns:
      the list of projects