Class TranslationResult<R>

  • Type Parameters:
    R - the top-level result model class

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

      Fields 
      Modifier and Type Field Description
      private MessageReceiver receiver
      Stores an instance which provides access to the messages which occurred during the model translation.
      private java.util.List<R> results
      Stores the created language units / models.
    • Constructor Summary

      Constructors 
      Constructor Description
      TranslationResult()
      Creates an empty instance of this class, e.g., to be used as a dummy translation result without real messages / results.
      TranslationResult​(java.util.List<R> results, MessageReceiver receiver)
      Creates an instance of this class.
    • Field Detail

      • receiver

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

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

      • 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​(java.util.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 Detail

      • 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:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getMessageCount()
      • getMessageList

        public java.util.List<IMessage> getMessageList()
        Returns the list of messages (using the more common type).
        Returns:
        the list of messages
      • getMessageListSpecific

        public java.util.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:
        java.lang.IndexOutOfBoundsException - if index<0 || index>=getResultCount()
      • getResultsList

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