net.sf.okapi.common.resource

## Class TextUnit

- java.lang.Object
- - net.sf.okapi.common.resource.TextUnit

- All Implemented Interfaces:
    IResource, INameable, IReferenceable, ITextUnit, IWithAnnotations, IWithBilingualProperties, IWithProperties

      public class TextUnit
      extends java.lang.Object
      implements ITextUnit

  Basic unit of extraction from a filter and also the resource associated with the filter event TEXT_UNIT. The TextUnit object holds the extracted source text in one or more versions, all its properties and annotations, and any target corresponding data.

- - ### Field Summary

    - ### Fields inherited from interface net.sf.okapi.common.resource.ITextUnit

      `TYPE_CDATA, TYPE_HEADER, TYPE_LIST_ELEMENT, TYPE_PARA, TYPE_TITLE`

    - ### Fields inherited from interface net.sf.okapi.common.IResource

      `COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextUnit()`
    `TextUnit(java.lang.String id)` Creates a new TextUnit object with its identifier.
    `TextUnit(java.lang.String id, java.lang.String sourceText)` Creates a new TextUnit object with its identifier and a text.
    `TextUnit(java.lang.String id, java.lang.String sourceText, boolean isReferent)` Creates a new TextUnit object with its ID, a text, and a flag indicating if it is a referent or not.
    `TextUnit(java.lang.String id, java.lang.String sourceText, boolean isReferent, java.lang.String mimeType)` Creates a new TextUnit object with its identifier, a text, a flag indicating if it is a referent or not, and a given MIME type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TextUnit` | `clone()` Clones this TextUnit.
    `void` | `createSourceSegmentation(ISegmenter segmenter)` Segments the default source content based on the rules provided by a given ISegmenter.
    `TextContainer` | `createTarget(LocaleId targetLocale, boolean overwriteExisting, int creationOptions)` Creates or get the target for this TextUnit.
    `Property` | `createTargetProperty(LocaleId locId, java.lang.String name, boolean overwriteExisting, int creationOptions)` Creates or get a target property based on the corresponding source.
    `void` | `createTargetSegmentation(ISegmenter segmenter, LocaleId targetLocale)` Segments the specified target content based on the rules provided by a given ISegmenter.
    `IAlignedSegments` | `getAlignedSegments()` Creates a new `IAlignedSegments` object to access and manipulate the segments of this text unit.
    `<A extends IAnnotation> A` | `getAnnotation(java.lang.Class<A> annotationType)` Gets the annotation object for a given class for this resource.
    `java.lang.Iterable<IAnnotation>` | `getAnnotations()` Gets the iterable list of the annotations for this resource.
    `java.lang.String` | `getId()` Gets the identifier of the resource.
    `java.lang.String` | `getMimeType()` Gets the type of content of this resource.
    `java.lang.String` | `getName()` Gets the name of this resource.
    `protected java.util.LinkedHashMap<java.lang.String,Property>` | `getProperties()`
    `Property` | `getProperty(java.lang.String name)` Gets the resource-level property for a given name.
    `java.util.Set<java.lang.String>` | `getPropertyNames()` Gets the names of all the resource-level properties for this resource.
    `int` | `getReferenceCount()` Gets the number of time this referent is referenced to.
    `ISkeleton` | `getSkeleton()` Gets the skeleton object for this resource.
    `TextContainer` | `getSource()` Gets the source object for this text unit (a `TextContainer` object).
    `Property` | `getSourceProperty(java.lang.String name)` Gets the source property for a given name.
    `java.util.Set<java.lang.String>` | `getSourcePropertyNames()` Gets the names of all the source properties for this resource.
    `Segment` | `getSourceSegment(java.lang.String segId, boolean createIfNeeded)` Gets the source segment for a given segment id.
    `ISegments` | `getSourceSegments()` Gets the segments for the source.
    `TextContainer` | `getTarget(LocaleId locId)` Gets the target object for this text unit for a given locale.
    `java.util.Set<LocaleId>` | `getTargetLocales()` Gets all the target locales for this resource.
    `Property` | `getTargetProperty(LocaleId locId, java.lang.String name)` Gets the target property for a given name and target locale.
    `java.util.Set<java.lang.String>` | `getTargetPropertyNames(LocaleId locId)` Gets the names of all the properties for a given target locale in this resource.
    `Segment` | `getTargetSegment(LocaleId trgLoc, java.lang.String segId, boolean createIfNeeded)` Gets the segment for a given segment id in a given target.
    `ISegments` | `getTargetSegments(LocaleId trgLoc)` Get the segments for a given target.
    `java.lang.String` | `getType()` Gets the type information associated with this resource.
    `boolean` | `hasProperty(java.lang.String name)` Indicates if a resource-level property exists for a given name.
    `boolean` | `hasSourceProperty(java.lang.String name)` Indicates if a source property exists for a given name.
    `boolean` | `hasTarget(LocaleId locId)` Indicates if there is a target object for a given locale for this text unit.
    `boolean` | `hasTargetProperty(LocaleId locId, java.lang.String name)` Indicates if a property exists for a given name and target locale.
    `boolean` | `isEmpty()` Indicates if the source text of this TextUnit is empty.
    `boolean` | `isReferent()` Indicates if this resource is a referent (i.e.
    `boolean` | `isTranslatable()` Indicates if the content of this resource is translatable.
    `boolean` | `preserveWhitespaces()` Indicates if the white-spaces in the content of this resource should be preserved.
    `void` | `removeAllSegmentations()` Removes all segmentations (source and targets) in this text unit.
    `void` | `removeProperty(java.lang.String name)` Removes a resource-level property of a given name.
    `void` | `removeSourceProperty(java.lang.String name)` Removes a source property of a given name.
    `void` | `removeTarget(LocaleId locId)` Removes a given target object from this text unit.
    `void` | `removeTargetProperty(LocaleId locId, java.lang.String name)` Removes a target property of a given name.
    `void` | `setAnnotation(IAnnotation annotation)` Sets an annotation object for this resource.
    `protected void` | `setAnnotations(Annotations annotations)` Used by TextUnit clone method to copy over all annotations at once.
    `void` | `setId(java.lang.String id)` Sets the identifier of this resource.
    `void` | `setIsReferent(boolean value)` Sets the flag indicating if this resource is a referent (i.e.
    `void` | `setIsTranslatable(boolean value)` Sets the flag indicating if the content of this resource is translatable.
    `void` | `setMimeType(java.lang.String mimeType)` Sets the type of content of this resource.
    `void` | `setName(java.lang.String name)` Sets the name of this resource.
    `void` | `setPreserveWhitespaces(boolean value)` sets the flag indicating if the white-spaces in the content of this resource should be preserved.
    `protected void` | `setProperties(java.util.LinkedHashMap<java.lang.String,Property> properties)`
    `Property` | `setProperty(Property property)` Sets a resource-level property.
    `void` | `setReferenceCount(int value)` Sets the number of time this referent is referenced to.
    `void` | `setSkeleton(ISkeleton skeleton)` Sets the skeleton object for this resource.
    `TextContainer` | `setSource(TextContainer textContainer)` Sets the source object for this TextUnit.
    `TextFragment` | `setSourceContent(TextFragment content)` Sets the content of the source for this TextUnit.
    `Property` | `setSourceProperty(Property property)` Sets a source property.
    `TextContainer` | `setTarget(LocaleId locId, TextContainer text)` Sets the target object for this text unit for a given locale.
    `TextFragment` | `setTargetContent(LocaleId locId, TextFragment content)` Sets the content of the target for a given locale for this TextUnit.
    `Property` | `setTargetProperty(LocaleId locId, Property property)` Sets a target property.
    `void` | `setType(java.lang.String value)` Sets the type information associated with this resource.
    `java.lang.String` | `toString()` Gets the string representation of the default source container.

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

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

- - ### Constructor Detail

    - #### TextUnit

          public TextUnit()

    - #### TextUnit

          public TextUnit(java.lang.String id)

      Creates a new TextUnit object with its identifier.
      Parameters:
        `id` - the identifier of this resource.

    - #### TextUnit

          public TextUnit(java.lang.String id,
                  java.lang.String sourceText)

      Creates a new TextUnit object with its identifier and a text.
      Parameters:
        `id` - the identifier of this resource.
        `sourceText` - the initial text of the source.

    - #### TextUnit

          public TextUnit(java.lang.String id,
                  java.lang.String sourceText,
                  boolean isReferent)

      Creates a new TextUnit object with its ID, a text, and a flag indicating if it is a referent or not.
      Parameters:
        `id` - the identifier of this resource.
        `sourceText` - the initial text of the source (can be null).
        `isReferent` - indicates if this resource is a referent (i.e. is referred to by another resource) or not.

    - #### TextUnit

          public TextUnit(java.lang.String id,
                  java.lang.String sourceText,
                  boolean isReferent,
                  java.lang.String mimeType)

      Creates a new TextUnit object with its identifier, a text, a flag indicating if it is a referent or not, and a given MIME type.
      Parameters:
        `id` - the identifier of this resource.
        `sourceText` - the initial text of the source (can be null).
        `isReferent` - indicates if this resource is a referent (i.e. is referred to by another resource) or not.
        `mimeType` - the MIME type identifier for the content of this TextUnit.

  - ### Method Detail

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `ITextUnit`
      Indicates if the source text of this TextUnit is empty.
      Specified by:
        `isEmpty` in interface `ITextUnit`
      Returns:
        true if the source text of this TextUnit is empty, false otherwise.

    - #### getSource

          public TextContainer getSource()

      Description copied from interface: `ITextUnit`
      Gets the source object for this text unit (a `TextContainer` object).
      Specified by:
        `getSource` in interface `ITextUnit`
      Returns:
        the source object for this text unit.

    - #### setSource

          public TextContainer setSource(TextContainer textContainer)

      Description copied from interface: `ITextUnit`
      Sets the source object for this TextUnit. Any existing source object is overwritten.
      Specified by:
        `setSource` in interface `ITextUnit`
      Parameters:
        `textContainer` - the source object to set.
      Returns:
        the source object that has been set.

    - #### setSourceContent

          public TextFragment setSourceContent(TextFragment content)

      Description copied from interface: `ITextUnit`
      Sets the content of the source for this TextUnit.
      Specified by:
        `setSourceContent` in interface `ITextUnit`
      Parameters:
        `content` - the new content to set.
      Returns:
        the new content of the source for this TextUnit.

    - #### createTarget

          public TextContainer createTarget(LocaleId targetLocale,
                                   boolean overwriteExisting,
                                   int creationOptions)

      Description copied from interface: `ITextUnit`
      Creates or get the target for this TextUnit.

      If a variant source exists for the target locale, creationOptions apply to the variant source.

      Specified by:
        `createTarget` in interface `ITextUnit`
      Parameters:
        `targetLocale` - the target locale.
        `overwriteExisting` - true to overwrite any existing target for the given locale. False to not create a new target object if one already exists for the given locale.
        `creationOptions` - creation options:
        - CREATE_EMPTY: Create an empty target object.
        - COPY_PROPERTIES: Copy the source properties.
        - COPY_CONTENT: Copy the text of the source (and any associated in-line code), but not the segmenation.
        - COPY_SEGMENTATION: Copy the source segmentation.
        - COPY_SEGMENTED_CONTENT: Same as (COPY_CONTENT|COPY_SEGMENTATION).
        - COPY_ALL: Same as (COPY_SEGMENTED_CONTENT|COPY_PROPERTIES).
      Returns:
        the target object that was created, or retrieved.

    - #### getTarget

          public TextContainer getTarget(LocaleId locId)

      Description copied from interface: `ITextUnit`
      Gets the target object for this text unit for a given locale. If the target does not exists a null is retruned.
      Specified by:
        `getTarget` in interface `ITextUnit`
      Parameters:
        `locId` - the locale to query.
      Returns:
        the target object for this text unit for the given locale, or null if the target does not exist.
      See Also:
        `ITextUnit.createTarget(LocaleId, boolean, int)`

    - #### setTarget

          public TextContainer setTarget(LocaleId locId,
                                TextContainer text)

      Description copied from interface: `ITextUnit`
      Sets the target object for this text unit for a given locale.

      If the target does not exists, one is created. Any existing content for the given locale is overwritten. To set a target object based on the source, use the `ITextUnit.createTarget(LocaleId, boolean, int)` method.

      Specified by:
        `setTarget` in interface `ITextUnit`
      Parameters:
        `locId` - the target locale.
        `text` - the target content to set.
      Returns:
        the target content that has been set.

    - #### removeTarget

          public void removeTarget(LocaleId locId)

      Description copied from interface: `ITextUnit`
      Removes a given target object from this text unit. If the given locale does not exist in this text unit nothing happens. Variant source for this target locale will not be affected.
      Specified by:
        `removeTarget` in interface `ITextUnit`
      Parameters:
        `locId` - the target locale to remove.

    - #### hasTarget

          public boolean hasTarget(LocaleId locId)

      Description copied from interface: `ITextUnit`
      Indicates if there is a target object for a given locale for this text unit.
      Specified by:
        `hasTarget` in interface `ITextUnit`
      Parameters:
        `locId` - the locale to query.
      Returns:
        true if a target object exists for the given locale, false otherwise.

    - #### setTargetContent

          public TextFragment setTargetContent(LocaleId locId,
                                      TextFragment content)

      Description copied from interface: `ITextUnit`
      Sets the content of the target for a given locale for this TextUnit.

      If the target does not exists, one is created. Any existing content for the given locale is overwritten. To set a target object based on the source, use the `ITextUnit.createTarget(LocaleId, boolean, int)` method.

      Specified by:
        `setTargetContent` in interface `ITextUnit`
      Parameters:
        `locId` - the locale to set.
        `content` - the new content to set.
      Returns:
        the new content for the given target locale for this text unit.

    - #### getAlignedSegments

          public IAlignedSegments getAlignedSegments()

      Description copied from interface: `ITextUnit`
      Creates a new `IAlignedSegments` object to access and manipulate the segments of this text unit.
      Specified by:
        `getAlignedSegments` in interface `ITextUnit`
      Returns:
        a new `IAlignedSegments` object.

    - #### getSourceSegments

          public ISegments getSourceSegments()

      Description copied from interface: `ITextUnit`
      Gets the segments for the source. Un-segmented content return a single segment.
      Specified by:
        `getSourceSegments` in interface `ITextUnit`
      Returns:
        an object implementing ISegments for the source content.

    - #### getSourceSegment

          public Segment getSourceSegment(java.lang.String segId,
                                 boolean createIfNeeded)

      Description copied from interface: `ITextUnit`
      Gets the source segment for a given segment id.

      If the segment does not exists, one is created if `createIfNeeded` is true.

      Specified by:
        `getSourceSegment` in interface `ITextUnit`
      Parameters:
        `segId` - the id of the segment to retrieve.
        `createIfNeeded` - true to append a segment at the end of the content and return it if the segment does not exist yet. False to return null when the segment does not exists.
      Returns:
        the found or created segment, or null.

    - #### getTargetSegments

          public ISegments getTargetSegments(LocaleId trgLoc)

      Description copied from interface: `ITextUnit`
      Get the segments for a given target. Un-segmented content return a single segment. If the target does not exists, one is created, with the same segments as the source, but empty.
      Specified by:
        `getTargetSegments` in interface `ITextUnit`
      Parameters:
        `trgLoc` - the locale of the target to retrieve.
      Returns:
        an object implementing ISegments for the given target content.

    - #### getTargetSegment

          public Segment getTargetSegment(LocaleId trgLoc,
                                 java.lang.String segId,
                                 boolean createIfNeeded)

      Description copied from interface: `ITextUnit`
      Gets the segment for a given segment id in a given target.

      If the target does not exists, one is created.

      If the segment does not exists, one is created if `createIfNeeded` is true.

      Specified by:
        `getTargetSegment` in interface `ITextUnit`
      Parameters:
        `trgLoc` - the target locale to look up.
        `segId` - the id of the segment to retrieve.
        `createIfNeeded` - true to append a segment at the end of the target content and return it if the segment does not exist yet. False to return null when the segment does not exists.
      Returns:
        the found or created segment, or null.

    - #### getTargetLocales

          public java.util.Set<LocaleId> getTargetLocales()

      Description copied from interface: `IWithBilingualProperties`
      Gets all the target locales for this resource.
      Specified by:
        `getTargetLocales` in interface `IWithBilingualProperties`
      Returns:
        all the target locales for this resource.

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `INameable`
      Gets the name of this resource. The resource name corresponds to different things depending on the type of resource. For a StartDocument the name is the URI of the document. Otherwise, in most cases the name is the identifier of the resource (This is the equivalent of the XLIFF resname attribute).
      Specified by:
        `getName` in interface `INameable`
      Returns:
        This resource name, or null if there is none.

    - #### setName

          public void setName(java.lang.String name)

      Description copied from interface: `INameable`
      Sets the name of this resource. The resource name is the equivalent of the XLIFF resname attribute.
      Specified by:
        `setName` in interface `INameable`
      Parameters:
        `name` - New name to set.

    - #### getType

          public java.lang.String getType()

      Description copied from interface: `INameable`
      Gets the type information associated with this resource. For example "button".
      Specified by:
        `getType` in interface `INameable`
      Returns:
        The type information associated with this resource.

    - #### setType

          public void setType(java.lang.String value)

      Description copied from interface: `INameable`
      Sets the type information associated with this resource. For example "button".
      Specified by:
        `setType` in interface `INameable`
      Parameters:
        `value` - The new type information.

    - #### getMimeType

          public java.lang.String getMimeType()

      Description copied from interface: `INameable`
      Gets the type of content of this resource. For example "text/xml".
      Specified by:
        `getMimeType` in interface `INameable`
      Returns:
        The type of content of this resource.

    - #### setMimeType

          public void setMimeType(java.lang.String mimeType)

      Description copied from interface: `INameable`
      Sets the type of content of this resource. For example "text/xml".
      Specified by:
        `setMimeType` in interface `INameable`
      Parameters:
        `mimeType` - The new type of content of this resource.

    - #### isTranslatable

          public boolean isTranslatable()

      Description copied from interface: `INameable`
      Indicates if the content of this resource is translatable. By default this indicator is set to true for all resources.
      Specified by:
        `isTranslatable` in interface `INameable`
      Returns:
        True if the content of this resource is translatable. False if it is not translatable.

    - #### setIsTranslatable

          public void setIsTranslatable(boolean value)

      Description copied from interface: `INameable`
      Sets the flag indicating if the content of this resource is translatable.
      Specified by:
        `setIsTranslatable` in interface `INameable`
      Parameters:
        `value` - True to indicate that the content of this resource is translatable.

    - #### preserveWhitespaces

          public boolean preserveWhitespaces()

      Description copied from interface: `INameable`
      Indicates if the white-spaces in the content of this resource should be preserved. By default this indicator is set to false for all resources.
      Specified by:
        `preserveWhitespaces` in interface `INameable`
      Returns:
        True if the white-spaces in the content of this resource should be preserved.

    - #### setPreserveWhitespaces

          public void setPreserveWhitespaces(boolean value)

      Description copied from interface: `INameable`
      sets the flag indicating if the white-spaces in the content of this resource should be preserved.
      Specified by:
        `setPreserveWhitespaces` in interface `INameable`
      Parameters:
        `value` - True to indicate that the white-spaces in the content of this resource should be preserved.

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `IResource`
      Gets the identifier of the resource. This identifier is unique per extracted document and by type of resource. This value is filter-specific. It and may be different from one extraction of the same document to the next. It can a sequential number or not, incremental or not, and it can be not a number. It has no correspondence in the source document ("IDs" coming from the source document are "names" and not available for all resources).
      Specified by:
        `getId` in interface `IResource`
      Returns:
        the identifier of this resource.

    - #### setId

          public void setId(java.lang.String id)

      Description copied from interface: `IResource`
      Sets the identifier of this resource.
      Specified by:
        `setId` in interface `IResource`
      Parameters:
        `id` - the new identifier value.
      See Also:
        `IResource.getId()`

    - #### getSkeleton

          public ISkeleton getSkeleton()

      Description copied from interface: `IResource`
      Gets the skeleton object for this resource.
      Specified by:
        `getSkeleton` in interface `IResource`
      Returns:
        the skeleton object for this resource or null if there is none.

    - #### setSkeleton

          public void setSkeleton(ISkeleton skeleton)

      Description copied from interface: `IResource`
      Sets the skeleton object for this resource.
      Specified by:
        `setSkeleton` in interface `IResource`
      Parameters:
        `skeleton` - the skeleton object to set.

    - #### isReferent

          public boolean isReferent()

      Description copied from interface: `IReferenceable`
      Indicates if this resource is a referent (i.e. is referred to by another resource) or not.
      Specified by:
        `isReferent` in interface `IReferenceable`
      Returns:
        true if this resource is a referent, false if it is not.

    - #### setIsReferent

          public void setIsReferent(boolean value)

      Description copied from interface: `IReferenceable`
      Sets the flag indicating if this resource is a referent (i.e. is referred to by another resource) or not. This also sets the count of time this referent is referenced to 1.
      Specified by:
        `setIsReferent` in interface `IReferenceable`
      Parameters:
        `value` - true if the resource is a referent, false if it is not.

    - #### getReferenceCount

          public int getReferenceCount()

      Description copied from interface: `IReferenceable`
      Gets the number of time this referent is referenced to.
      Specified by:
        `getReferenceCount` in interface `IReferenceable`
      Returns:
        the number of time this referent is referenced to.

    - #### setReferenceCount

          public void setReferenceCount(int value)

      Description copied from interface: `IReferenceable`
      Sets the number of time this referent is referenced to.
      Specified by:
        `setReferenceCount` in interface `IReferenceable`
      Parameters:
        `value` - the number of time this referent is referenced to.

    - #### getPropertyNames

          public java.util.Set<java.lang.String> getPropertyNames()

      Description copied from interface: `IWithProperties`
      Gets the names of all the resource-level properties for this resource.
      Specified by:
        `getPropertyNames` in interface `IWithProperties`
      Returns:
        All the names of the resource-level properties for this resource.

    - #### getProperty

          public Property getProperty(java.lang.String name)

      Description copied from interface: `IWithProperties`
      Gets the resource-level property for a given name.
      Specified by:
        `getProperty` in interface `IWithProperties`
      Parameters:
        `name` - Name of the property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### setProperty

          public Property setProperty(Property property)

      Description copied from interface: `IWithProperties`
      Sets a resource-level property. If a property already exists it is overwritten.
      Specified by:
        `setProperty` in interface `IWithProperties`
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### removeProperty

          public void removeProperty(java.lang.String name)

      Description copied from interface: `IWithProperties`
      Removes a resource-level property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeProperty` in interface `IWithProperties`
      Parameters:
        `name` - The name of the property to remove.

    - #### hasProperty

          public boolean hasProperty(java.lang.String name)

      Description copied from interface: `IWithProperties`
      Indicates if a resource-level property exists for a given name.
      Specified by:
        `hasProperty` in interface `IWithProperties`
      Parameters:
        `name` - The name of the resource-level property to query.
      Returns:
        True if a resource-level property exists, false otherwise.

    - #### getAnnotation

          public <A extends IAnnotation> A getAnnotation(java.lang.Class<A> annotationType)

      Description copied from interface: `IWithAnnotations`
      Gets the annotation object for a given class for this resource.
      Specified by:
        `getAnnotation` in interface `IWithAnnotations`
      Type Parameters:
        `A` - the type of the class.
      Parameters:
        `annotationType` - the class of the annotation object to retrieve.
      Returns:
        the annotation for the given class for this resource.

    - #### setAnnotation

          public void setAnnotation(IAnnotation annotation)

      Description copied from interface: `IWithAnnotations`
      Sets an annotation object for this resource.
      Specified by:
        `setAnnotation` in interface `IWithAnnotations`
      Parameters:
        `annotation` - the annotation object to set.

    - #### getAnnotations

          public java.lang.Iterable<IAnnotation> getAnnotations()

      Description copied from interface: `IWithAnnotations`
      Gets the iterable list of the annotations for this resource.
      Specified by:
        `getAnnotations` in interface `IWithAnnotations`
      Returns:
        the iterable list of the annotations for this resource.

    - #### getSourceProperty

          public Property getSourceProperty(java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Gets the source property for a given name.
      Specified by:
        `getSourceProperty` in interface `IWithBilingualProperties`
      Parameters:
        `name` - The name of the source property to retrieve.
      Returns:
        The property or null if it does not exist.

    - #### setSourceProperty

          public Property setSourceProperty(Property property)

      Description copied from interface: `IWithBilingualProperties`
      Sets a source property. If a property already exists it is overwritten.
      Specified by:
        `setSourceProperty` in interface `IWithBilingualProperties`
      Parameters:
        `property` - The new property to set.
      Returns:
        The property that has been set.

    - #### removeSourceProperty

          public void removeSourceProperty(java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Removes a source property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeSourceProperty` in interface `IWithBilingualProperties`
      Parameters:
        `name` - The name of the property to remove.

    - #### getSourcePropertyNames

          public java.util.Set<java.lang.String> getSourcePropertyNames()

      Description copied from interface: `IWithBilingualProperties`
      Gets the names of all the source properties for this resource.
      Specified by:
        `getSourcePropertyNames` in interface `IWithBilingualProperties`
      Returns:
        All the names of the source properties for this resource.

    - #### hasSourceProperty

          public boolean hasSourceProperty(java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Indicates if a source property exists for a given name.
      Specified by:
        `hasSourceProperty` in interface `IWithBilingualProperties`
      Parameters:
        `name` - The name of the source property to query.
      Returns:
        True if a source property exists, false otherwise.

    - #### getTargetProperty

          public Property getTargetProperty(LocaleId locId,
                                   java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Gets the target property for a given name and target locale.
      Specified by:
        `getTargetProperty` in interface `IWithBilingualProperties`
      Parameters:
        `locId` - the locale of the property to retrieve.
        `name` - The name of the property to retrieve. This name is case-sensitive.
      Returns:
        The property or null if it does not exist.

    - #### setTargetProperty

          public Property setTargetProperty(LocaleId locId,
                                   Property property)

      Description copied from interface: `IWithBilingualProperties`
      Sets a target property. If a property already exists it is overwritten.
      Specified by:
        `setTargetProperty` in interface `IWithBilingualProperties`
      Parameters:
        `locId` - The target locale for which this property should be set.
        `property` - The new property to set. This name is case-sensitive.
      Returns:
        The property that has been set.

    - #### removeTargetProperty

          public void removeTargetProperty(LocaleId locId,
                                  java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Removes a target property of a given name. If the property does not exists nothing happens.
      Specified by:
        `removeTargetProperty` in interface `IWithBilingualProperties`
      Parameters:
        `locId` - The target locale for which this property should be set.
        `name` - The name of the property to remove.

    - #### getTargetPropertyNames

          public java.util.Set<java.lang.String> getTargetPropertyNames(LocaleId locId)

      Description copied from interface: `IWithBilingualProperties`
      Gets the names of all the properties for a given target locale in this resource.
      Specified by:
        `getTargetPropertyNames` in interface `IWithBilingualProperties`
      Parameters:
        `locId` - the target locale to query.
      Returns:
        all the names of the target properties for the given locale in this resource.

    - #### hasTargetProperty

          public boolean hasTargetProperty(LocaleId locId,
                                  java.lang.String name)

      Description copied from interface: `IWithBilingualProperties`
      Indicates if a property exists for a given name and target locale.
      Specified by:
        `hasTargetProperty` in interface `IWithBilingualProperties`
      Parameters:
        `locId` - the target locale to query.
        `name` - the name of the property to query.
      Returns:
        true if a property exists, false otherwise.

    - #### createTargetProperty

          public Property createTargetProperty(LocaleId locId,
                                      java.lang.String name,
                                      boolean overwriteExisting,
                                      int creationOptions)

      Description copied from interface: `INameable`
      Creates or get a target property based on the corresponding source.
      Specified by:
        `createTargetProperty` in interface `INameable`
      Parameters:
        `locId` - The target locale to use.
        `name` - The name of the property to create (or retrieve)
        `overwriteExisting` - True to overwrite any existing property. False to not create a new property if one exists already.
        `creationOptions` - Creation options:
        - CREATE_EMPTY: Creates an empty property, only the read-only flag of the source is copied.
        - COPY_CONTENT: Creates a new property with all its data copied from the source.
      Returns:
        The property that was created, or retrieved.

    - #### toString

          public java.lang.String toString()

      Gets the string representation of the default source container. If the container is segmented, the representation shows the merged segments. Inline codes are also included.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string representation of the source container.

    - #### clone

          public TextUnit clone()

      Clones this TextUnit.
      Specified by:
        `clone` in interface `ITextUnit`
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        A new TextUnit object that is a copy of this one.

    - #### removeAllSegmentations

          public void removeAllSegmentations()

      Description copied from interface: `ITextUnit`
      Removes all segmentations (source and targets) in this text unit. All entries are converted to non-segmented entries.
      Specified by:
        `removeAllSegmentations` in interface `ITextUnit`

    - #### createSourceSegmentation

          public void createSourceSegmentation(ISegmenter segmenter)

      Description copied from interface: `ITextUnit`
      Segments the default source content based on the rules provided by a given ISegmenter.
      Specified by:
        `createSourceSegmentation` in interface `ITextUnit`
      Parameters:
        `segmenter` - the segmenter to use to create the segments.

    - #### createTargetSegmentation

          public void createTargetSegmentation(ISegmenter segmenter,
                                      LocaleId targetLocale)

      Description copied from interface: `ITextUnit`
      Segments the specified target content based on the rules provided by a given ISegmenter.
      Specified by:
        `createTargetSegmentation` in interface `ITextUnit`
      Parameters:
        `segmenter` - the segmenter to use to create the segments.
        `targetLocale` - `LocaleId` of the target we want to segment.

    - #### setAnnotations

          protected void setAnnotations(Annotations annotations)

      Used by TextUnit clone method to copy over all annotations at once.
      Parameters:
        `annotations` - the new annotations to set.

    - #### getProperties

          protected java.util.LinkedHashMap<java.lang.String,Property> getProperties()

    - #### setProperties

          protected void setProperties(java.util.LinkedHashMap<java.lang.String,Property> properties)