net.sf.okapi.common.resource

## Class TextPart

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

- Direct Known Subclasses:
    Segment

      public class TextPart
      extends java.lang.Object

  Implements the base object for the parts that make up a content.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `TextFragment` | `text` Text fragment of this part.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextPart()` Creates an empty part.
    `TextPart(java.lang.String text)` Creates a new TextPart with a given text string.
    `TextPart(TextFragment text)` Creates a new TextPart with a given `TextFragment`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TextPart` | `clone()`
    `TextFragment` | `getContent()` Gets the text fragment for this part.
    `boolean` | `isSegment()` Indicates if this part is a `Segment`.
    `void` | `setContent(TextFragment fragment)` Sets the `TextFragment` for this part.
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### text

          public TextFragment text

      Text fragment of this part.

  - ### Constructor Detail

    - #### TextPart

          public TextPart()

      Creates an empty part.

    - #### TextPart

          public TextPart(TextFragment text)

      Creates a new TextPart with a given `TextFragment`.
      Parameters:
        `text` - the `TextFragment` for this new part.

    - #### TextPart

          public TextPart(java.lang.String text)

      Creates a new TextPart with a given text string.
      Parameters:
        `text` - the text for this new part.

  - ### Method Detail

    - #### clone

          public TextPart clone()

      Overrides:
        `clone` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getContent

          public TextFragment getContent()

      Gets the text fragment for this part.
      Returns:
        the text fragment for this part.

    - #### setContent

          public void setContent(TextFragment fragment)

      Sets the `TextFragment` for this part.
      Parameters:
        `fragment` - the `TextFragment` to assign to this part. It must not be null.

    - #### isSegment

          public boolean isSegment()

      Indicates if this part is a `Segment`.
      Returns:
        true if the part is a `Segment`, false if it is not.