|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.okapi.common.filterwriter.ext.GenericContent
public class GenericContent
Handles the conversion between a coded text object and a generic markup string.
Constructor Summary | |
---|---|
GenericContent()
|
|
GenericContent(net.sf.okapi.common.resource.TextFragment content)
|
Method Summary | |
---|---|
static java.lang.String |
fromFragmentToLetterCoded(net.sf.okapi.common.resource.TextFragment fragment)
Deprecated. |
static java.lang.String |
fromFragmentToLetterCoded(net.sf.okapi.common.resource.TextFragment fragment,
boolean encodeExistingLetterCodes)
Converts a text fragment into a letter-coded text, optionally escaping tags that will interfere with conversion back to a fragment. |
static net.sf.okapi.common.resource.TextFragment |
fromLetterCodedToFragment(java.lang.String text,
net.sf.okapi.common.resource.TextFragment fragment,
boolean reuseCodes)
Deprecated. |
static net.sf.okapi.common.resource.TextFragment |
fromLetterCodedToFragment(java.lang.String text,
net.sf.okapi.common.resource.TextFragment fragment,
boolean reuseCodes,
boolean decodeEncodedLetterCodes)
Converts a letter-coded text to a fragment. |
net.sf.okapi.common.Range |
getCodedTextPosition(net.sf.okapi.common.Range position)
Gets the matching position in the coded text string of a given position in the generic text output. |
java.lang.String |
printMarkerIndexes()
Generates a coded string containing code indexes in place of two-char code markers. |
java.lang.String |
printSegmentedContent(net.sf.okapi.common.resource.TextContainer container,
boolean showSegments)
Prints a generic string representation of a given segmented text, with optional markers to indicate the segments boundaries. |
java.lang.String |
printSegmentedContent(net.sf.okapi.common.resource.TextContainer container,
boolean showSegments,
boolean normalText)
Prints a string representation of a given segmented text, with optional markers to indicate the segments boundaries. |
GenericContent |
setContent(net.sf.okapi.common.resource.TextFragment content)
|
java.lang.String |
toString()
Generates an generic coded string from the content. |
java.lang.String |
toString(boolean normalText)
Generates a generic coded string or an normal output from the content. |
static void |
updateFragment(java.lang.String genericText,
net.sf.okapi.common.resource.TextFragment fragment,
boolean allowCodeDeletion)
Updates a text fragment from a generic representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GenericContent()
public GenericContent(net.sf.okapi.common.resource.TextFragment content)
Method Detail |
---|
public GenericContent setContent(net.sf.okapi.common.resource.TextFragment content)
public java.lang.String printSegmentedContent(net.sf.okapi.common.resource.TextContainer container, boolean showSegments)
container
- The container to output.showSegments
- True if segment boundaries should be shown.
public java.lang.String printSegmentedContent(net.sf.okapi.common.resource.TextContainer container, boolean showSegments, boolean normalText)
container
- the container to output.showSegments
- true if segment boundaries should be shown.normalText
- true to show in-line real data instead of generic codes.
public java.lang.String printMarkerIndexes()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean normalText)
normalText
- True to show in-line real data instead of generic codes.
public net.sf.okapi.common.Range getCodedTextPosition(net.sf.okapi.common.Range position)
position
- Generic text position to convert to coded text position.
public static void updateFragment(java.lang.String genericText, net.sf.okapi.common.resource.TextFragment fragment, boolean allowCodeDeletion)
genericText
- The generic text to use to update the fragment.fragment
- The text fragment to update.allowCodeDeletion
- True when missing in-line codes in the generic text
means the corresponding codes should be deleted from the fragment.
net.sf.okapi.common.resource.InvalidContentException
- When the generic text is not valid, or does
not correspond to the existing codes.@Deprecated public static net.sf.okapi.common.resource.TextFragment fromLetterCodedToFragment(java.lang.String text, net.sf.okapi.common.resource.TextFragment fragment, boolean reuseCodes)
A letter-coded text is like "<g1>text<x2/></g1><b3/>".
text
- the text to convert.fragment
- optional existing fragment where to set the converted data, or null to create a new fragment.
If an existing fragment is provided, no existing code is preserved: all codes are coming from the parsing
of the input text, except if reuseCodes is set to true.reuseCodes
- true to re-use the codes of the provided text fragment. If a code is not found in the
provided text fragment, one is created for the output.
public static net.sf.okapi.common.resource.TextFragment fromLetterCodedToFragment(java.lang.String text, net.sf.okapi.common.resource.TextFragment fragment, boolean reuseCodes, boolean decodeEncodedLetterCodes)
A letter-coded text is like "<g1>text<x2/></g1><b3/>".
text
- the text to convert.fragment
- optional existing fragment where to set the converted data, or null to create a new fragment.
If an existing fragment is provided, no existing code is preserved: all codes are coming from the parsing
of the input text, except if reuseCodes is set to true.reuseCodes
- true to re-use the codes of the provided text fragment. If a code is not found in the
provided text fragment, one is created for the output.decodeEncodedLetterCodes
- true to reverse previous tag escaping, this should match the value of encodeExistingLetterCodes when the text was tag encoded
@Deprecated public static java.lang.String fromFragmentToLetterCoded(net.sf.okapi.common.resource.TextFragment fragment)
fromLetterCodedToFragment(String, TextFragment, boolean)
to convert back to a fragment.
fragment
- the fragment to convert.
public static java.lang.String fromFragmentToLetterCoded(net.sf.okapi.common.resource.TextFragment fragment, boolean encodeExistingLetterCodes)
fromLetterCodedToFragment(String, TextFragment, boolean, boolean)
to
convert back to a fragment.
fragment
- the fragment to convert.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |