net.sf.okapi.common.skeleton

## Class GenericSkeletonWriter

- java.lang.Object
- - net.sf.okapi.common.skeleton.GenericSkeletonWriter

- All Implemented Interfaces:
    ISkeletonWriter

      public class GenericSkeletonWriter
      extends java.lang.Object
      implements ISkeletonWriter

  Implements ISkeletonWriter for the GenericSkeleton skeleton.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `allowEmptyOutputTarget`
    `static java.lang.String` | `ALLOWEMPTYOUTPUTTARGET`
    `protected EncoderManager` | `encoderManager`
    `protected LocaleId` | `inputLoc`
    `protected boolean` | `isMultilingual`
    `protected ILayerProvider` | `layer`
    `protected java.lang.String` | `outputEncoding`
    `protected LocaleId` | `outputLoc`
    `protected java.util.Stack<StorageList>` | `storageStack`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericSkeletonWriter()`
    `GenericSkeletonWriter(LocaleId inputLoc, LocaleId outputLoc, ILayerProvider layer, EncoderManager encoderManager, boolean isMultilingual, boolean allowEmptyOutputTarget, java.util.Map<java.lang.String,Referent> referents, java.lang.String outputEncoding, int referentCopies, SubFilterSkeletonWriter sfWriter)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `_processEndGroup(Ending resource)`
    `protected java.lang.String` | `_processStartGroup(StartGroup resource)`
    `void` | `addToReferents(Event event)`
    `void` | `close()` Closes this skeleton writer.
    `protected java.lang.String` | `expandCodeContent(Code code, LocaleId locToUse, EncoderContext context)`
    `protected java.lang.String` | `getContent(ITextUnit tu, LocaleId locToUse, EncoderContext context)` Gets the original content of a given text unit.
    `java.lang.String` | `getContent(TextFragment tf, LocaleId locToUse, EncoderContext context)` Gets the original content of a TextFragment.
    `EncoderManager` | `getEncoderManager()`
    `LocaleId` | `getInputLoc()`
    `ILayerProvider` | `getLayer()`
    `java.lang.String` | `getOutputEncoding()`
    `LocaleId` | `getOutputLoc()`
    `protected java.lang.String` | `getPropertyValue(INameable resource, java.lang.String name, LocaleId locToUse, EncoderContext context)`
    `protected IReferenceable` | `getReference(java.lang.String id)`
    `int` | `getReferentCopies()`
    `java.util.Map<java.lang.String,Referent>` | `getReferents()`
    `ISkeletonWriter` | `getSfWriter()`
    `protected java.lang.String` | `getString(GenericSkeletonPart part, EncoderContext context)`
    `protected java.lang.String` | `getString(INameable ref, java.lang.String propName, LocaleId locToUse, EncoderContext context)`
    `protected java.lang.String` | `getString(ISkeleton skeleton, EncoderContext context)`
    `protected java.lang.String` | `getString(ITextUnit tu, LocaleId locToUse, EncoderContext context)` Gets the skeleton and the original content of a given text unit.
    `protected java.lang.String` | `getString(StorageList list, LocaleId locToUse, EncoderContext context)`
    `boolean` | `isAllowEmptyOutputTarget()`
    `boolean` | `isMultilingual()`
    `java.lang.String` | `processDocumentPart(DocumentPart resource)` Processes the DOCUMENT_PART event.
    `java.lang.String` | `processEndDocument(Ending resource)` Processes the END_DOCUMENT event.
    `java.lang.String` | `processEndGroup(Ending resource)` Processes the END_GROUP event.
    `java.lang.String` | `processEndSubDocument(Ending resource)` Processes the END_SUBDOCUMENT event.
    `java.lang.String` | `processEndSubfilter(EndSubfilter resource)`
    `java.lang.String` | `processStartDocument(LocaleId outputLocale, java.lang.String outputEncoding, ILayerProvider layer, EncoderManager encoderManager, StartDocument resource)` Processes the START_DOCUMENT event.
    `java.lang.String` | `processStartGroup(StartGroup resource)` Processes the START_GROUP event.
    `java.lang.String` | `processStartSubDocument(StartSubDocument resource)` Processes a START_SUBDOCUMENT event.
    `java.lang.String` | `processStartSubfilter(StartSubfilter resource)`
    `java.lang.String` | `processTextUnit(ITextUnit resource)` Processes the TEXT_UNIT event.
    `void` | `setAllowEmptyOutputTarget(boolean allowEmptyOutputTarget)`
    `void` | `setEncoderManager(EncoderManager encoderManager)`
    `void` | `setInputLoc(LocaleId inputLoc)`
    `void` | `setLayer(ILayerProvider layer)`
    `void` | `setMultilingual(boolean isMultilingual)`
    `void` | `setOutputEncoding(java.lang.String outputEncoding)`
    `void` | `setOutputLoc(LocaleId outputLoc)`
    `void` | `setReferentCopies(int referentCopies)` Sets the number of copies to keep for a referent.
    `void` | `setReferents(java.util.Map<java.lang.String,Referent> referents)`
    `void` | `setSfWriter(SubFilterSkeletonWriter sfWriter)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALLOWEMPTYOUTPUTTARGET

          public static final java.lang.String ALLOWEMPTYOUTPUTTARGET

      See Also:
        Constant Field Values

    - #### inputLoc

          protected LocaleId inputLoc

    - #### outputLoc

          protected LocaleId outputLoc

    - #### layer

          protected ILayerProvider layer

    - #### encoderManager

          protected EncoderManager encoderManager

    - #### storageStack

          protected java.util.Stack<StorageList> storageStack

    - #### isMultilingual

          protected boolean isMultilingual

    - #### allowEmptyOutputTarget

          protected boolean allowEmptyOutputTarget

    - #### outputEncoding

          protected java.lang.String outputEncoding

  - ### Constructor Detail

    - #### GenericSkeletonWriter

          public GenericSkeletonWriter()

    - #### GenericSkeletonWriter

          public GenericSkeletonWriter(LocaleId inputLoc,
                               LocaleId outputLoc,
                               ILayerProvider layer,
                               EncoderManager encoderManager,
                               boolean isMultilingual,
                               boolean allowEmptyOutputTarget,
                               java.util.Map<java.lang.String,Referent> referents,
                               java.lang.String outputEncoding,
                               int referentCopies,
                               SubFilterSkeletonWriter sfWriter)

  - ### Method Detail

    - #### getReference

          protected IReferenceable getReference(java.lang.String id)

    - #### close

          public void close()

      Description copied from interface: `ISkeletonWriter`
      Closes this skeleton writer.
      Specified by:
        `close` in interface `ISkeletonWriter`

    - #### setReferentCopies

          public void setReferentCopies(int referentCopies)

      Sets the number of copies to keep for a referent. By default one copy is kept and discarded after it is referenced. Some layout may need to refer to the referent more than once, for example when they output both source and target.
      Parameters:
        `referentCopies` - the number of copies to hold (must be at least 1).

    - #### processStartDocument

          public java.lang.String processStartDocument(LocaleId outputLocale,
                                              java.lang.String outputEncoding,
                                              ILayerProvider layer,
                                              EncoderManager encoderManager,
                                              StartDocument resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the START_DOCUMENT event.
      Specified by:
        `processStartDocument` in interface `ISkeletonWriter`
      Parameters:
        `outputLocale` - the output locale.
        `outputEncoding` - the name of the output charset encoding.
        `layer` - the layer provider to use.
        `encoderManager` - the encoder manager to use.
        `resource` - the StartDocument resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### processEndDocument

          public java.lang.String processEndDocument(Ending resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the END_DOCUMENT event.
      Specified by:
        `processEndDocument` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the Ending resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### processStartSubDocument

          public java.lang.String processStartSubDocument(StartSubDocument resource)

      Description copied from interface: `ISkeletonWriter`
      Processes a START_SUBDOCUMENT event.
      Specified by:
        `processStartSubDocument` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the StartSubDocument resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### processEndSubDocument

          public java.lang.String processEndSubDocument(Ending resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the END_SUBDOCUMENT event.
      Specified by:
        `processEndSubDocument` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the Ending resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### processStartGroup

          public java.lang.String processStartGroup(StartGroup resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the START_GROUP event.
      Specified by:
        `processStartGroup` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the StartGroup resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### _processStartGroup

          protected java.lang.String _processStartGroup(StartGroup resource)

    - #### processEndGroup

          public java.lang.String processEndGroup(Ending resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the END_GROUP event.
      Specified by:
        `processEndGroup` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the Ending resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### _processEndGroup

          protected java.lang.String _processEndGroup(Ending resource)

    - #### processStartSubfilter

          public java.lang.String processStartSubfilter(StartSubfilter resource)

      Specified by:
        `processStartSubfilter` in interface `ISkeletonWriter`

    - #### processEndSubfilter

          public java.lang.String processEndSubfilter(EndSubfilter resource)

      Specified by:
        `processEndSubfilter` in interface `ISkeletonWriter`

    - #### processTextUnit

          public java.lang.String processTextUnit(ITextUnit resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the TEXT_UNIT event.
      Specified by:
        `processTextUnit` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the TextUnit resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### processDocumentPart

          public java.lang.String processDocumentPart(DocumentPart resource)

      Description copied from interface: `ISkeletonWriter`
      Processes the DOCUMENT_PART event.
      Specified by:
        `processDocumentPart` in interface `ISkeletonWriter`
      Parameters:
        `resource` - the DocumentPart resource associated with the event.
      Returns:
        the string output corresponding to this event.

    - #### getString

          protected java.lang.String getString(ISkeleton skeleton,
                                   EncoderContext context)

    - #### getString

          protected java.lang.String getString(GenericSkeletonPart part,
                                   EncoderContext context)

    - #### getString

          protected java.lang.String getString(INameable ref,
                                   java.lang.String propName,
                                   LocaleId locToUse,
                                   EncoderContext context)

    - #### getString

          protected java.lang.String getString(ITextUnit tu,
                                   LocaleId locToUse,
                                   EncoderContext context)

      Gets the skeleton and the original content of a given text unit.
      Parameters:
        `tu` - The text unit to process.
        `locToUse` - locale to output. Use null for the source, or a LocaleId object for the target locales.
        `context` - Context flag: 0=text, 1=skeleton, 2=in-line.
      Returns:
        The string representation of the text unit.

    - #### getContent

          protected java.lang.String getContent(ITextUnit tu,
                                    LocaleId locToUse,
                                    EncoderContext context)

      Gets the original content of a given text unit.
      Parameters:
        `tu` - The text unit to process.
        `locToUse` - locale to output. Use null for the source, or the locale for the target locales.
        `context` - Context flag: 0=text, 1=skeleton, 2=inline.
      Returns:
        The string representation of the text unit content.

    - #### getContent

          public java.lang.String getContent(TextFragment tf,
                                    LocaleId locToUse,
                                    EncoderContext context)

      Gets the original content of a TextFragment.
      Parameters:
        `tf` - the TextFragment to process.
        `locToUse` - locale to output. Use null for the source, or the locale for the target locales. This is used for referenced content in inline codes.
        `context` - Context flag: 0=text, 1=skeleton, 2=inline.
      Returns:
        The string representation of the text unit content.

    - #### expandCodeContent

          protected java.lang.String expandCodeContent(Code code,
                                           LocaleId locToUse,
                                           EncoderContext context)

    - #### getString

          protected java.lang.String getString(StorageList list,
                                   LocaleId locToUse,
                                   EncoderContext context)

    - #### getPropertyValue

          protected java.lang.String getPropertyValue(INameable resource,
                                          java.lang.String name,
                                          LocaleId locToUse,
                                          EncoderContext context)

    - #### addToReferents

          public void addToReferents(Event event)

    - #### getLayer

          public ILayerProvider getLayer()

    - #### getInputLoc

          public final LocaleId getInputLoc()

    - #### getOutputLoc

          public final LocaleId getOutputLoc()

    - #### getEncoderManager

          public final EncoderManager getEncoderManager()

    - #### isMultilingual

          public final boolean isMultilingual()

    - #### isAllowEmptyOutputTarget

          public final boolean isAllowEmptyOutputTarget()

    - #### getReferents

          public final java.util.Map<java.lang.String,Referent> getReferents()

    - #### setReferents

          public void setReferents(java.util.Map<java.lang.String,Referent> referents)

    - #### getOutputEncoding

          public final java.lang.String getOutputEncoding()

    - #### getReferentCopies

          public final int getReferentCopies()

    - #### getSfWriter

          public final ISkeletonWriter getSfWriter()

    - #### setOutputLoc

          public void setOutputLoc(LocaleId outputLoc)

    - #### setLayer

          public void setLayer(ILayerProvider layer)

    - #### setEncoderManager

          public void setEncoderManager(EncoderManager encoderManager)

    - #### setMultilingual

          public void setMultilingual(boolean isMultilingual)

    - #### setAllowEmptyOutputTarget

          public void setAllowEmptyOutputTarget(boolean allowEmptyOutputTarget)

    - #### setOutputEncoding

          public void setOutputEncoding(java.lang.String outputEncoding)

    - #### setSfWriter

          public void setSfWriter(SubFilterSkeletonWriter sfWriter)

    - #### setInputLoc

          public void setInputLoc(LocaleId inputLoc)