Package org.omegat.filters3
Class Text
- java.lang.Object
-
- org.omegat.filters3.Text
-
- All Implemented Interfaces:
Element
- Direct Known Subclasses:
XMLEntityText,XMLText
public abstract class Text extends java.lang.Object implements Element
Abstract piece of text.P.S. The most important method is
createInstance(String).
-
-
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 voidappend(java.lang.String text)abstract TextcreateInstance(java.lang.String text)Creates a new instance of the same class as this one.java.lang.StringgetText()Returns the piece of text stored.booleanisMeaningful()Whether the text is meaningful, i.e.abstract java.lang.StringtoOriginal()Returns the text in its original form as it was in original document.java.lang.StringtoSafeCalcShortcut()Returns shorcuts like '\b_i0_\b' for statistics calculationjava.lang.StringtoShortcut()Returns shortcut string representation of the element.java.lang.StringtoTMX()Returns long XML-encoded representation of the element.
-
-
-
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 asV <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 appropriatetoOriginal()methods for storing translated text, so it would pick any of the original Text instances, e.g. Text[Friday], and callcreateInstance("V "),createInstance("pyatnitzu"), andcreateInstance(" ya vlyublyon.").
-
toShortcut
public java.lang.String toShortcut()
Returns shortcut string representation of the element. Basically, the text itself.- Specified by:
toShortcutin interfaceElement
-
toSafeCalcShortcut
public java.lang.String toSafeCalcShortcut()
Description copied from interface:ElementReturns shorcuts like '\b_i0_\b' for statistics calculation- Specified by:
toSafeCalcShortcutin interfaceElement
-
toTMX
public java.lang.String toTMX()
Returns long XML-encoded representation of the element. Basically, the XML-encoded text (< -> < etc). E.g. forRock&Rollshould returnRock&Roll.
-
toOriginal
public abstract java.lang.String toOriginal()
Returns the text in its original form as it was in original document. E.g. forRock&Rollshould returnRock&Rollfor XML andRock&Rollfor text files.- Specified by:
toOriginalin interfaceElement
-
-