net.sf.okapi.common.skeleton

## Class SkeletonUtil

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

-     public class SkeletonUtil
      extends java.lang.Object

  Helper methods to manipulate skeleton objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SkeletonUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `changeParent(ISkeleton skel, IResource curParent, IResource newParent)`
    `static int` | `findTuRefInSkeleton(GenericSkeleton skel)` Finds source reference in the skeleton.
    `static int` | `findTuRefInSkeleton(GenericSkeleton skel, LocaleId locId)` Finds either source or target reference in the skeleton.
    `static int` | `getNumParts(GenericSkeleton skel)`
    `static GenericSkeletonPart` | `getPart(GenericSkeleton skel, int index)`
    `static java.lang.String` | `getRefId(GenericSkeletonPart part)`
    `static boolean` | `hasTuRef(GenericSkeleton skel)` Determines if a given skeleton contains a source reference in it.
    `static boolean` | `hasTuRef(GenericSkeleton skel, LocaleId locId)` Determines if a given skeleton contains a target reference in a given locale.
    `static boolean` | `isExtPropValuePlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isExtSegmentPlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isExtSourcePlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isExtTargetPlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isPropRef(GenericSkeletonPart part)`
    `static boolean` | `isPropValuePlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isRef(GenericSkeletonPart part)`
    `static boolean` | `isReference(GenericSkeletonPart part)`
    `static boolean` | `isSegmentPlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isSegRef(GenericSkeletonPart part)`
    `static boolean` | `isSourcePlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isTargetPlaceholder(GenericSkeletonPart part, IResource resource)`
    `static boolean` | `isText(GenericSkeletonPart part)`
    `static boolean` | `isTuRef(GenericSkeletonPart part)`
    `static boolean` | `replaceSkeletonPart(GenericSkeleton skel, int index, GenericSkeleton replacement)` Replaces a part of a given skeleton with another given skeleton part.
    `static GenericSkeleton[]` | `splitSkeleton(GenericSkeleton skel)` Splits a given `GenericSkeleton` into 2 parts: before and after the content placeholder (self-marker).

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

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

- - ### Constructor Detail

    - #### SkeletonUtil

          public SkeletonUtil()

  - ### Method Detail

    - #### findTuRefInSkeleton

          public static int findTuRefInSkeleton(GenericSkeleton skel)

      Finds source reference in the skeleton.
      Parameters:
        `skel` - the skeleton being sought for the reference
      Returns:
        index in the list of skeleton parts for the skeleton part containing the reference

    - #### findTuRefInSkeleton

          public static int findTuRefInSkeleton(GenericSkeleton skel,
                                                LocaleId locId)

      Finds either source or target reference in the skeleton. If locId is specified, then its target reference is sought for.
      Parameters:
        `skel` - the skeleton being sought for the reference.
        `locId` - the locale to search the reference for.
      Returns:
        index in the list of skeleton parts for the skeleton part containing the reference.

    - #### hasTuRef

          public static boolean hasTuRef(GenericSkeleton skel)

      Determines if a given skeleton contains a source reference in it.
      Parameters:
        `skel` - the skeleton being sought for the reference.
      Returns:
        true if the given skeleton contains such a reference.

    - #### hasTuRef

          public static boolean hasTuRef(GenericSkeleton skel,
                                         LocaleId locId)

      Determines if a given skeleton contains a target reference in a given locale.
      Parameters:
        `skel` - the skeleton being sought for the reference.
        `locId` - the locale of the target part being sought.
      Returns:
        true if the given skeleton contains such a reference.

    - #### splitSkeleton

          public static GenericSkeleton[] splitSkeleton(GenericSkeleton skel)

      Splits a given `GenericSkeleton` into 2 parts: before and after the content placeholder (self-marker).
      Parameters:
        `skel` - the given `GenericSkeleton`.
      Returns:
        array of 2 `GenericSkeleton`s before and after self-marker.

    - #### replaceSkeletonPart

          public static boolean replaceSkeletonPart(GenericSkeleton skel,
                                                    int index,
                                                    GenericSkeleton replacement)

      Replaces a part of a given skeleton with another given skeleton part.
      Parameters:
        `skel` - the skeleton which part is being replaced.
        `index` - the index of the skeleton part to be replaced.
        `replacement` - the given new skeleton part to replace the existing one.
      Returns:
        true if replacement succeeded.

    - #### getNumParts

          public static int getNumParts(GenericSkeleton skel)

    - #### getPart

          public static GenericSkeletonPart getPart(GenericSkeleton skel,
                                                    int index)

    - #### isTuRef

          public static boolean isTuRef(GenericSkeletonPart part)

    - #### isRef

          public static boolean isRef(GenericSkeletonPart part)

    - #### isPropRef

          public static boolean isPropRef(GenericSkeletonPart part)

    - #### isSegRef

          public static boolean isSegRef(GenericSkeletonPart part)

    - #### isSourcePlaceholder

          public static boolean isSourcePlaceholder(GenericSkeletonPart part,
                                                    IResource resource)

    - #### isTargetPlaceholder

          public static boolean isTargetPlaceholder(GenericSkeletonPart part,
                                                    IResource resource)

    - #### isPropValuePlaceholder

          public static boolean isPropValuePlaceholder(GenericSkeletonPart part,
                                                       IResource resource)

    - #### isSegmentPlaceholder

          public static boolean isSegmentPlaceholder(GenericSkeletonPart part,
                                                     IResource resource)

    - #### isExtSourcePlaceholder

          public static boolean isExtSourcePlaceholder(GenericSkeletonPart part,
                                                       IResource resource)

    - #### isExtTargetPlaceholder

          public static boolean isExtTargetPlaceholder(GenericSkeletonPart part,
                                                       IResource resource)

    - #### isExtPropValuePlaceholder

          public static boolean isExtPropValuePlaceholder(GenericSkeletonPart part,
                                                          IResource resource)

    - #### isExtSegmentPlaceholder

          public static boolean isExtSegmentPlaceholder(GenericSkeletonPart part,
                                                        IResource resource)

    - #### isReference

          public static boolean isReference(GenericSkeletonPart part)

    - #### isText

          public static boolean isText(GenericSkeletonPart part)

    - #### getRefId

          public static java.lang.String getRefId(GenericSkeletonPart part)

    - #### changeParent

          public static void changeParent(ISkeleton skel,
                                          IResource curParent,
                                          IResource newParent)