net.sf.okapi.lib.xliff2.core

## Class CTag

- java.lang.Object
- - net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
  - - net.sf.okapi.lib.xliff2.core.Tag
    - - net.sf.okapi.lib.xliff2.core.CTag

- All Implemented Interfaces:
    IWithExtAttributes

      public class CTag
      extends Tag

  Represents an opening, closing or standalone tag for an original inline code.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected net.sf.okapi.lib.xliff2.core.CTagCommon` | `cc`

    - ### Fields inherited from class net.sf.okapi.lib.xliff2.core.Tag

      `tagType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CTag(TagType tagType, java.lang.String id, java.lang.String data)` Creates a new code tag (without any link to another tag).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Tag tag)` Indicates if this tag is equal to another.
    `boolean` | `getCanCopy()` Indicates if this code can be copied.
    `boolean` | `getCanDelete()` Indicates if this code can be deleted.
    `boolean` | `getCanOverlap()` Indicates if this spanning code can overlap others (i.e.
    `CanReorder` | `getCanReorder()` Indicates if this code can be re-ordered.
    `java.lang.String` | `getCopyOf()` Gets the ID of the code from which this code is a copy.
    `java.lang.String` | `getData()` Gets the original data of this code's tag.
    `Directionality` | `getDataDir()` Gets the directionality of the original data of this code's tag.
    `java.lang.String` | `getDataRef()` Gets the ID of the element where this code's tag is stored.
    `Directionality` | `getDir()` Gets the directionality of the content of this code.
    `java.lang.String` | `getDisp()` Gets the user-friendly representation of the data of this code's tag.
    `java.lang.String` | `getEquiv()` Gets the text equivalent representation of the data of this code's tag.
    `java.lang.String` | `getId()` Gets the id for the code or annotation using this tag.
    `java.lang.String` | `getSubFlows()` Gets the IDs of the units representing the sub-flows for this code's tag.
    `java.lang.String[]` | `getSubFlowsIds()` Gets an array of the IDs of the units representing the sub-flows for this code's tag.
    `java.lang.String` | `getSubType()` Gets the sub-type of this code.
    `java.lang.String` | `getType()` Gets the type of the code or marker this tag represents.
    `boolean` | `hasData()` Indicates if this code's tag has some content for its original data.
    `boolean` | `isCode()` Indicates if this tag is for a code (`CTag`).
    `boolean` | `isInitialWithData()` Indicates if this code's tag had an original data initially (when read from the document).
    `boolean` | `isMarker()` Indicates if this tag is for a marker (`MTag`).
    `void` | `setCanCopy(boolean canCopy)` Sets the flag indicating if this code can be copied (for both opening/closing tags).
    `void` | `setCanDelete(boolean canDelete)` Sets the flag indicating if this code can be deleted (for both opening/closing tags).
    `void` | `setCanOverlap(boolean canOverlap)` sets the flag indicating if this code can overlap others (for both opening/closing tags).
    `void` | `setCanReorder(CanReorder canReorder)` Sets the flag indicating if this code can be re-ordered.
    `void` | `setCopyOf(java.lang.String id)` Sets the ID of the code from which this code is a copy (for both opening/closing tags).
    `void` | `setData(java.lang.String data)` Sets the original data of this code's tag.
    `void` | `setDataDir(Directionality dir)` Sets the directionality of the original data of this code's tag.
    `void` | `setDataRef(java.lang.String dataRef)` Sets the ID of the element where this code's tag is stored.
    `void` | `setDir(Directionality dir)` Sets the directionality of the content of this code (for both opening/closing tags).
    `void` | `setDisp(java.lang.String disp)` Sets the user-friendly representation of the data of this code's tag.
    `void` | `setEquiv(java.lang.String equiv)` Sets the text equivalent representation of the data of this code's tag.
    `void` | `setInitialWithData(boolean initialWithData)` Sets the flag indicating if this code's tag had an original data initially.
    `void` | `setSubFlows(java.lang.String subFlows)` Sets the IDs of the units representing the sub-flows for this code's tag.
    `void` | `setSubType(java.lang.String subType)` Sets the sub-type of this code (for both opening/closing tags).
    `void` | `setType(java.lang.String type)` Sets the type of the code or marker (for both opening/closing tags).
    `void` | `verifyTypeSubTypeValues()` Verifies the type and sub-type values.

    - ### Methods inherited from class net.sf.okapi.lib.xliff2.core.Tag

      `getTagType, toString`

    - ### Methods inherited from class net.sf.okapi.lib.xliff2.core.DataWithExtAttributes

      `getExtAttributes, getExtAttributeValue, hasExtAttribute, setExtAttributes`

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

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

- - ### Field Detail

    - #### cc

          protected net.sf.okapi.lib.xliff2.core.CTagCommon cc

  - ### Constructor Detail

    - #### CTag

          public CTag(TagType tagType,
              java.lang.String id,
              java.lang.String data)

      Creates a new code tag (without any link to another tag).
      Parameters:
        `tagType` - the tag type.
        `id` - the id (should not be null).
        `data` - the data (can be null).

  - ### Method Detail

    - #### equals

          public boolean equals(Tag tag)

      Description copied from class: `Tag`
      Indicates if this tag is equal to another.

      Use the `==` operator to test if two tags are the same.

      Parameters:
        `tag` - the other tag to compare to this one.
      Returns:
        true if both tags are equals.

    - #### isCode

          public boolean isCode()

      Description copied from class: `Tag`
      Indicates if this tag is for a code (`CTag`).
      Specified by:
        `isCode` in class `Tag`
      Returns:
        true if this tag is used by a code (`CTag`), false if it is for a marker (`MTag`).

    - #### isMarker

          public boolean isMarker()

      Description copied from class: `Tag`
      Indicates if this tag is for a marker (`MTag`).
      Specified by:
        `isMarker` in class `Tag`
      Returns:
        true if this tag is one for a marker (`MTag`), false if it is for a code (`CTag`).

    - #### getId

          public java.lang.String getId()

      Description copied from class: `Tag`
      Gets the id for the code or annotation using this tag.
      Specified by:
        `getId` in class `Tag`
      Returns:
        the id for the code or annotation using this tag.

    - #### getType

          public java.lang.String getType()

      Description copied from class: `Tag`
      Gets the type of the code or marker this tag represents.
      Specified by:
        `getType` in class `Tag`
      Returns:
        the type of the code or marker this tag represents. If this is a `CTag` the type value can be null.

    - #### setType

          public void setType(java.lang.String type)

      Description copied from class: `Tag`
      Sets the type of the code or marker (for both opening/closing tags).
      Specified by:
        `setType` in class `Tag`
      Parameters:
        `type` - the type of the code or marker this tag represents.

    - #### getSubType

          public java.lang.String getSubType()

      Gets the sub-type of this code.
      Returns:
        the sub-type of this code.

    - #### setSubType

          public void setSubType(java.lang.String subType)

      Sets the sub-type of this code (for both opening/closing tags).
      Parameters:
        `subType` - the new sub-type of this code.

    - #### getCanCopy

          public boolean getCanCopy()

      Indicates if this code can be copied.
      Returns:
        true if this code can be copied, false if it cannot.

    - #### setCanCopy

          public void setCanCopy(boolean canCopy)

      Sets the flag indicating if this code can be copied (for both opening/closing tags).
      Parameters:
        `canCopy` - true to allow this code to be copied, false otherwise.

    - #### getCanOverlap

          public boolean getCanOverlap()

      Indicates if this spanning code can overlap others (i.e. be not well-formed). This information applies only to paired codes, not to standalone codes.
      Returns:
        true if this code can overlap others, false otherwise.

    - #### setCanOverlap

          public void setCanOverlap(boolean canOverlap)

      sets the flag indicating if this code can overlap others (for both opening/closing tags).
      Parameters:
        `canOverlap` - true to allow this code to overlap others, false otherwise.

    - #### getCanDelete

          public boolean getCanDelete()

      Indicates if this code can be deleted.
      Returns:
        true if this code can be deleted, false otherwise.

    - #### setCanDelete

          public void setCanDelete(boolean canDelete)

      Sets the flag indicating if this code can be deleted (for both opening/closing tags).
      Parameters:
        `canDelete` - true to allow this code to be deleted, false otherwise.

    - #### getCanReorder

          public CanReorder getCanReorder()

      Indicates if this code can be re-ordered.
      Returns:
        one of the `CanReorder` values. If the tag is a closing tag and the code is set to `CanReorder.FIRSTNO` this method return `CanReorder.NO` as the closing tag of a code cannot be a first-no (only an opening tag can be).

    - #### setCanReorder

          public void setCanReorder(CanReorder canReorder)

      Sets the flag indicating if this code can be re-ordered. If the new value is different from `CanReorder.YES` the `canDelete` and `canCopy` fields are set automatically to false.
      Parameters:
        `canReorder` - the new value for the flag indicating if this code can be re-ordered.

    - #### getCopyOf

          public java.lang.String getCopyOf()

      Gets the ID of the code from which this code is a copy.
      Returns:
        the ID of the code from which this code was copied (can be null).

    - #### setCopyOf

          public void setCopyOf(java.lang.String id)

      Sets the ID of the code from which this code is a copy (for both opening/closing tags).
      Parameters:
        `id` - the ID of the code from which this code was copied (can be null).

    - #### hasData

          public boolean hasData()

      Indicates if this code's tag has some content for its original data.
      Returns:
        true if the original data is neither null nor empty.

    - #### getData

          public java.lang.String getData()

      Gets the original data of this code's tag.
      Returns:
        the original data of this code's tag (can be null).

    - #### setData

          public void setData(java.lang.String data)

      Sets the original data of this code's tag.
      Parameters:
        `data` - the original data of this code's tag (can be null).

    - #### getDataRef

          public java.lang.String getDataRef()

      Gets the ID of the element where this code's tag is stored.
      Returns:
        the ID of the element where this code's tag is stored (can be null).

    - #### setDataRef

          public void setDataRef(java.lang.String dataRef)

      Sets the ID of the element where this code's tag is stored.
      Parameters:
        `dataRef` - the ID of the element where this code's tag is stored (can be null).

    - #### isInitialWithData

          public boolean isInitialWithData()

      Indicates if this code's tag had an original data initially (when read from the document).
      Returns:
        true if this code's tag had an original data initially.

    - #### setInitialWithData

          public void setInitialWithData(boolean initialWithData)

      Sets the flag indicating if this code's tag had an original data initially.
      Parameters:
        `initialWithData` - true to indicate that this code's tag had an original data initially.

    - #### getDataDir

          public Directionality getDataDir()

      Gets the directionality of the original data of this code's tag.
      Returns:
        the directionality of the original data of this code's tag.

    - #### setDataDir

          public void setDataDir(Directionality dir)

      Sets the directionality of the original data of this code's tag.
      Parameters:
        `dir` - the new directionality of the original data of this code's tag.

    - #### getDisp

          public java.lang.String getDisp()

      Gets the user-friendly representation of the data of this code's tag.
      Returns:
        the user-friendly representation of the data of this code's tag (can be null).

    - #### setDisp

          public void setDisp(java.lang.String disp)

      Sets the user-friendly representation of the data of this code's tag.
      Parameters:
        `disp` - the new user-friendly representation of the data of this code's tag.

    - #### getEquiv

          public java.lang.String getEquiv()

      Gets the text equivalent representation of the data of this code's tag.
      Returns:
        the text equivalent representation of the data of this code's tag (can be empty but not null).

    - #### setEquiv

          public void setEquiv(java.lang.String equiv)

      Sets the text equivalent representation of the data of this code's tag.
      Parameters:
        `equiv` - the new text equivalent representation of the data of this code's tag. A null value will result in an empty string representation.

    - #### getSubFlows

          public java.lang.String getSubFlows()

      Gets the IDs of the units representing the sub-flows for this code's tag.
      Returns:
        the IDs of the units representing the sub-flows for this code's tag.

    - #### setSubFlows

          public void setSubFlows(java.lang.String subFlows)

      Sets the IDs of the units representing the sub-flows for this code's tag. The list is automatically normalized.
      Parameters:
        `subFlows` - the new IDs of the units representing the sub-flows for this code's tag.

    - #### getSubFlowsIds

          public java.lang.String[] getSubFlowsIds()

      Gets an array of the IDs of the units representing the sub-flows for this code's tag.
      Returns:
        an array of IDs (can be empty but is never null).

    - #### getDir

          public Directionality getDir()

      Gets the directionality of the content of this code.
      Returns:
        the directionality of the content of this code.

    - #### setDir

          public void setDir(Directionality dir)

      Sets the directionality of the content of this code (for both opening/closing tags).
      Parameters:
        `dir` - the new directionality of the content of this code.

    - #### verifyTypeSubTypeValues

          public void verifyTypeSubTypeValues()

      Verifies the type and sub-type values.
      Throws:
        `InvalidParameterException` - if a value is invalid.