Class Text

    • Constructor Summary

      Constructors 
      Constructor Description
      Text​(java.lang.String text)
      Creates a new instance of Text initialized with some text.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(java.lang.String text)  
      abstract Text createInstance​(java.lang.String text)
      Creates a new instance of the same class as this one.
      java.lang.String getText()
      Returns the piece of text stored.
      boolean isMeaningful()
      Whether the text is meaningful, i.e.
      abstract java.lang.String toOriginal()
      Returns the text in its original form as it was in original document.
      java.lang.String toSafeCalcShortcut()
      Returns shorcuts like '\b_i0_\b' for statistics calculation
      java.lang.String toShortcut()
      Returns shortcut string representation of the element.
      java.lang.String toTMX()
      Returns long XML-encoded representation of the element.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Text

        public Text​(java.lang.String text)
        Creates a new instance of Text initialized with some text.
    • Method Detail

      • getText

        public java.lang.String getText()
        Returns the piece of text stored.
      • isMeaningful

        public boolean isMeaningful()
        Whether the text is meaningful, i.e. contains anything but space.
      • append

        public void append​(java.lang.String text)
      • createInstance

        public abstract Text createInstance​(java.lang.String text)
        Creates a new instance of the same class as this one. This method is used while translating to create pieces of translated text.

        For example, the following HTML sentence <i>Friday</i> I'm in love. (Tag[<i>], Text[Friday], Tag[</i>], Text[ I'm in love.]) can be translated as V <i>pyatnitzu</i> ya vlyublyon. (Text[V ], Tag[<i>], Text[pyatnitzu], Tag[</i>], Text[ ya vlyublyon.]). Tags are the same, but text is translated. Even the number of text elements might change! So OmegaT must be able to create Text classes with appropriate toOriginal() methods for storing translated text, so it would pick any of the original Text instances, e.g. Text[Friday], and call createInstance("V "), createInstance("pyatnitzu"), and createInstance(" ya vlyublyon.").

      • toShortcut

        public java.lang.String toShortcut()
        Returns shortcut string representation of the element. Basically, the text itself.
        Specified by:
        toShortcut in interface Element
      • toSafeCalcShortcut

        public java.lang.String toSafeCalcShortcut()
        Description copied from interface: Element
        Returns shorcuts like '\b_i0_\b' for statistics calculation
        Specified by:
        toSafeCalcShortcut in interface Element
      • toTMX

        public java.lang.String toTMX()
        Returns long XML-encoded representation of the element. Basically, the XML-encoded text (< -> &lt; etc). E.g. for Rock&Roll should return Rock&Roll.
        Specified by:
        toTMX in interface Element
      • toOriginal

        public abstract java.lang.String toOriginal()
        Returns the text in its original form as it was in original document. E.g. for Rock&Roll should return Rock&Roll for XML and Rock&Roll for text files.
        Specified by:
        toOriginal in interface Element