net.sf.okapi.common.skeleton

## Class ResourceSimplifier

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

-     public class ResourceSimplifier
      extends java.lang.Object

  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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceSimplifier(GenericSkeletonWriter writer, java.lang.String outEncoding, LocaleId trgLoc)`
    `ResourceSimplifier(LocaleId trgLoc)`
    `ResourceSimplifier(java.lang.String outEncoding, LocaleId trgLoc)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Event` | `convert(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.
    `java.util.List<Event>` | `convertToList(Event event)` Converts a given event into a list of events 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.
    `static MultiEvent` | `packMultiEvent(MultiEvent me)` Merges adjacent document parts into one.

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

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

- - ### Constructor Detail

    - #### ResourceSimplifier

          public ResourceSimplifier(LocaleId trgLoc)

    - #### ResourceSimplifier

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

    - #### ResourceSimplifier

          public ResourceSimplifier(GenericSkeletonWriter writer,
                            java.lang.String outEncoding,
                            LocaleId trgLoc)

  - ### Method Detail

    - #### packMultiEvent

          public static MultiEvent packMultiEvent(MultiEvent me)

      Merges adjacent document parts into one. Will work for simple resources only.

    - #### convertToList

          public java.util.List<Event> convertToList(Event event)

      Converts a given event into a list of events 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.
      Parameters:
        `event` - the given event
      Returns:
        list of simplified events or original event

    - #### convert

          public Event convert(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.
      Parameters:
        `event` - the given event
      Returns:
        the given event or a newly created multi-event