Class Translation


  • public class Translation
    extends java.lang.Object
    Translation class holding the information processed by the translation engine.
    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      java.lang.Throwableexception
      Exception for failure, null otherwise.
      java.lang.StringoriginalLangID
      The original language ID.
      java.lang.StringoriginalText
      The original text as passed in to the translator.
      KStringsourceText
      The KString as the source text.
      booleansuccess
      Success flag: the members translatedText, translationLangID can be used (not null).
      java.lang.StringtranslatedText
      The translated text, null for failure.
      java.lang.StringtranslationLangID
      The translation language ID.
      ITranslatortranslator
      The translator that provided the translation.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      Translation​(ITranslator translator, KString sourceText, java.lang.String originalText, java.lang.String originalLangID, java.lang.String translatedText, java.lang.String translationLangID)
      Constructs the successful Translation.
      Translation​(ITranslator translator, KString sourceText, java.lang.String originalText, java.lang.String originalLangID, java.lang.String translationLangID, java.lang.Throwable exception)
      Constructs the failed Translation, only from the engine itself.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetTranslatorName()
      Gets the name of the translator.
      java.lang.StringtoString()
      The string representation of this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • originalText

        public final java.lang.String originalText
        The original text as passed in to the translator.
      • originalLangID

        public final java.lang.String originalLangID
        The original language ID. If no language is set on translation request, this member will contain what the Translator detected as language. This member may be null when the translation failed.
      • translatedText

        public final java.lang.String translatedText
        The translated text, null for failure.
      • translationLangID

        public final java.lang.String translationLangID
        The translation language ID.
      • sourceText

        public final KString sourceText
        The KString as the source text.
      • translator

        public final ITranslator translator
        The translator that provided the translation.
      • success

        public final boolean success
        Success flag: the members translatedText, translationLangID can be used (not null).
      • exception

        public final java.lang.Throwable exception
        Exception for failure, null otherwise.
    • Constructor Detail

      • Translation

        public Translation​(ITranslator translator,
                           KString sourceText,
                           java.lang.String originalText,
                           java.lang.String originalLangID,
                           java.lang.String translatedText,
                           java.lang.String translationLangID)
        Constructs the successful Translation.
        Parameters:
        translator - The translator.
        sourceText - The KString source text.
        originalText - The original text as passed in to the translator.
        originalLangID - The original language. If no language is set on translation request, this member will contain what the translation engine detected as language.
        translatedText - The translated text.
        translationLangID - The translation language.
      • Translation

        public Translation​(ITranslator translator,
                           KString sourceText,
                           java.lang.String originalText,
                           java.lang.String originalLangID,
                           java.lang.String translationLangID,
                           java.lang.Throwable exception)
        Constructs the failed Translation, only from the engine itself.
        Parameters:
        translator - The translator.
        sourceText - The KString source text.
        originalText - The original text as passed in to the translator.
        originalLangID - The original language. If no language is set on translation request, this member will contain what the translation engine detected as language, null if this failed.
        translationLangID - The translation language.
        exception - The exception.
    • Method Detail

      • toString

        public java.lang.String toString()
        The string representation of this class.
        Overrides:
        toString in class java.lang.Object
      • getTranslatorName

        public java.lang.String getTranslatorName()
        Gets the name of the translator.