net.sf.okapi.common.skeleton

## Class GenericSkeletonSimplifier

- java.lang.Object
- - net.sf.okapi.common.resource.simplifier.AbstractResourceSimplifier
  - - net.sf.okapi.common.skeleton.GenericSkeletonSimplifier

- All Implemented Interfaces:
    IEventConverter, IResourceSimplifier

      public class GenericSkeletonSimplifier
      extends AbstractResourceSimplifier

  Simplifies events, i.e. splits the generic skeleton of a given event resource into parts to contain no references. The skeleton parts are attached to newly created DOCUMENT_PART events. Original references are converted either to skeleton parts, or TEXT_UNIT events. The sequence of DOCUMENT_PART and TEXT_UNIT events is packed into a single MULTI_EVENT event. This class can handle only GenericSkeletonWriter and its subclasses.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericSkeletonSimplifier()`
    `GenericSkeletonSimplifier(boolean isMultilingual, GenericSkeletonWriter skelWriter, LocaleId trgLoc)`
    `GenericSkeletonSimplifier(boolean isMultilingual, GenericSkeletonWriter skelWriter, java.lang.String outEncoding, LocaleId trgLoc)`
    `GenericSkeletonSimplifier(LocaleId trgLoc)`
    `GenericSkeletonSimplifier(java.lang.String outEncoding, LocaleId trgLoc)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Event` | `convertEvent(Event event)` Converts a given event into a multi-event if it contains references in its source's codes or in skeleton, or passes it on if either the skeleton is no instance of GenericSkeleton, contains no references, or the resource is referent.
    `void` | `initialize()`
    `static MultiEvent` | `packMultiEvent(MultiEvent me)` Merges adjacent document parts into one.

    - ### Methods inherited from class net.sf.okapi.common.resource.simplifier.AbstractResourceSimplifier

      `convert, convertToList, getFilterWriter, getGroup, getOutputEncoding, getParent, getSkeletonWriter, getTargetLocale, isMultilingual, setFilterWriter, setGroup, setMultilingual, setOutputEncoding, setParent, setSkeletonWriter, setTargetLocale`

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

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

- - ### Constructor Detail

    - #### GenericSkeletonSimplifier

          public GenericSkeletonSimplifier(LocaleId trgLoc)

    - #### GenericSkeletonSimplifier

          public GenericSkeletonSimplifier(java.lang.String outEncoding,
                                           LocaleId trgLoc)

    - #### GenericSkeletonSimplifier

          public GenericSkeletonSimplifier(boolean isMultilingual,
                                           GenericSkeletonWriter skelWriter,
                                           LocaleId trgLoc)

    - #### GenericSkeletonSimplifier

          public GenericSkeletonSimplifier(boolean isMultilingual,
                                           GenericSkeletonWriter skelWriter,
                                           java.lang.String outEncoding,
                                           LocaleId trgLoc)

    - #### GenericSkeletonSimplifier

          public GenericSkeletonSimplifier()

  - ### Method Detail

    - #### initialize

          public void initialize()

    - #### packMultiEvent

          public static MultiEvent packMultiEvent(MultiEvent me)

      Merges adjacent document parts into one. Will work for simple resources only.
      Parameters:
        `me` - the multi-event containing the events to merge.
      Returns:
        the resulting multi-event.

    - #### convertEvent

          protected Event convertEvent(Event event)

      Converts a given event into a multi-event if it contains references in its source's codes or in skeleton, or passes it on if either the skeleton is no instance of GenericSkeleton, contains no references, or the resource is referent.
      Specified by:
        `convertEvent` in class `AbstractResourceSimplifier`
      Parameters:
        `event` - the given event
      Returns:
        the given event or a newly created multi-event