Package net.sf.okapi.common.filters
Class SubFilterSkeletonWriter
- java.lang.Object
-
- net.sf.okapi.common.filters.SubFilterSkeletonWriter
-
- All Implemented Interfaces:
ISkeletonWriter
public class SubFilterSkeletonWriter extends Object implements ISkeletonWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SubFilterSkeletonWriter.TargetOutputs
Target outputs.
-
Field Summary
Fields Modifier and Type Field Description static String
GET_OUTPUT_TOKEN_ID
-
Constructor Summary
Constructors Constructor Description SubFilterSkeletonWriter(StartSubfilter resource)
SubFilterSkeletonWriter(ISkeletonWriter skelWriter, IEncoder parentEncoder, String startResourceId, Set<String> handledTextUnitIds, StringBuilder sourceOutput, SubFilterSkeletonWriter.TargetOutputs targetOutputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this skeleton writer.String
getEncodedOutput(LocaleId locToUse)
String
getOutput()
ISkeletonWriter
getSkelWriter()
String
getSourceOutput()
String
getStartResourceId()
String
processDocumentPart(DocumentPart resource)
Processes the DOCUMENT_PART event.String
processEndDocument(Ending resource)
Get output created by this skeleton writer from a sequence of events.String
processEndGroup(Ending resource)
Processes the END_GROUP event.String
processEndSubDocument(Ending resource)
Processes the END_SUBDOCUMENT event.String
processEndSubfilter(EndSubfilter resource)
String
processStartDocument(LocaleId outputLocale, String outputEncoding, EncoderManager encoderManager, StartDocument resource)
Processes the START_DOCUMENT event.String
processStartGroup(StartGroup resource)
Processes the START_GROUP event.String
processStartSubDocument(StartSubDocument resource)
Processes a START_SUBDOCUMENT event.String
processStartSubfilter(StartSubfilter resource)
String
processTextUnit(ITextUnit resource)
Processes the TEXT_UNIT event.String
processTextUnit(ITextUnit resource, boolean isMultilingual)
Used for multilingual skeleton writers.SubFilterSkeletonWriter
setOptions(LocaleId outputLocale, String outputEncoding, StartSubfilter startSubfilter)
void
updateTargetOutputs(String text)
-
-
-
Field Detail
-
GET_OUTPUT_TOKEN_ID
public static final String GET_OUTPUT_TOKEN_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubFilterSkeletonWriter
public SubFilterSkeletonWriter(StartSubfilter resource)
-
SubFilterSkeletonWriter
public SubFilterSkeletonWriter(ISkeletonWriter skelWriter, IEncoder parentEncoder, String startResourceId, Set<String> handledTextUnitIds, StringBuilder sourceOutput, SubFilterSkeletonWriter.TargetOutputs targetOutputs)
-
-
Method Detail
-
close
public void close()
Description copied from interface:ISkeletonWriter
Closes this skeleton writer.- Specified by:
close
in interfaceISkeletonWriter
-
getStartResourceId
public String getStartResourceId()
-
processStartDocument
public String processStartDocument(LocaleId outputLocale, String outputEncoding, EncoderManager encoderManager, StartDocument resource)
Description copied from interface:ISkeletonWriter
Processes the START_DOCUMENT event.- Specified by:
processStartDocument
in interfaceISkeletonWriter
- Parameters:
outputLocale
- the output locale.outputEncoding
- the name of the output charset encoding.encoderManager
- the encoder manager to use.resource
- the StartDocument resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndDocument
public String processEndDocument(Ending resource)
Get output created by this skeleton writer from a sequence of events. This method is useful when only an ISkeletonWriter reference is available.- Specified by:
processEndDocument
in interfaceISkeletonWriter
- Parameters:
resource
- can be with theGET_OUTPUT_TOKEN_ID
ID (to return the overall output of this skeleton writer), or any other Ending resource.- Returns:
- output of this skeleton writer if the resource is with the
GET_OUTPUT_TOKEN_ID
ID or an empty string otherwise.
-
processStartSubDocument
public String processStartSubDocument(StartSubDocument resource)
Description copied from interface:ISkeletonWriter
Processes a START_SUBDOCUMENT event.- Specified by:
processStartSubDocument
in interfaceISkeletonWriter
- Parameters:
resource
- the StartSubDocument resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndSubDocument
public String processEndSubDocument(Ending resource)
Description copied from interface:ISkeletonWriter
Processes the END_SUBDOCUMENT event.- Specified by:
processEndSubDocument
in interfaceISkeletonWriter
- Parameters:
resource
- the Ending resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processStartGroup
public String processStartGroup(StartGroup resource)
Description copied from interface:ISkeletonWriter
Processes the START_GROUP event.- Specified by:
processStartGroup
in interfaceISkeletonWriter
- Parameters:
resource
- the StartGroup resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processEndGroup
public String processEndGroup(Ending resource)
Description copied from interface:ISkeletonWriter
Processes the END_GROUP event.- Specified by:
processEndGroup
in interfaceISkeletonWriter
- Parameters:
resource
- the Ending resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processTextUnit
public String processTextUnit(ITextUnit resource)
Description copied from interface:ISkeletonWriter
Processes the TEXT_UNIT event.- Specified by:
processTextUnit
in interfaceISkeletonWriter
- Parameters:
resource
- the TextUnit resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processTextUnit
public String processTextUnit(ITextUnit resource, boolean isMultilingual)
Description copied from interface:ISkeletonWriter
Used for multilingual skeleton writers. Processes the TEXT_UNIT event.- Specified by:
processTextUnit
in interfaceISkeletonWriter
- Parameters:
resource
- the TextUnit resource associated with the event.isMultilingual
- true if theITextUnit
is multilingual.- Returns:
- the string output corresponding to this event.
-
processDocumentPart
public String processDocumentPart(DocumentPart resource)
Description copied from interface:ISkeletonWriter
Processes the DOCUMENT_PART event.- Specified by:
processDocumentPart
in interfaceISkeletonWriter
- Parameters:
resource
- the DocumentPart resource associated with the event.- Returns:
- the string output corresponding to this event.
-
processStartSubfilter
public String processStartSubfilter(StartSubfilter resource)
- Specified by:
processStartSubfilter
in interfaceISkeletonWriter
-
processEndSubfilter
public String processEndSubfilter(EndSubfilter resource)
- Specified by:
processEndSubfilter
in interfaceISkeletonWriter
-
getSourceOutput
public String getSourceOutput()
-
getOutput
public String getOutput()
-
updateTargetOutputs
public void updateTargetOutputs(String text)
-
setOptions
public SubFilterSkeletonWriter setOptions(LocaleId outputLocale, String outputEncoding, StartSubfilter startSubfilter)
-
getSkelWriter
public ISkeletonWriter getSkelWriter()
-
-