net.sf.okapi.lib.xliff2.core

## Class MTag

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

- All Implemented Interfaces:
    IWithExtAttributes, IWithITSAttributes
  Direct Known Subclasses:
    TermTag

      public class MTag
      extends Tag
      implements IWithITSAttributes

  Represents an opening or closing tag for an annotation marker.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected net.sf.okapi.lib.xliff2.core.MTagCommon` | `mc`
    `static java.lang.String` | `TYPE_DEFAULT` Default type of a marker.

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

      `tagType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MTag(MTag opposite)` Creates a new opening or closing tag for a marker.
    `MTag(MTag original, MTag opposite)` Copy constructor.
    `MTag(java.lang.String id, java.lang.String type)` Creates a new opening tag for a marker.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Tag tag)` Indicates if this tag is equal to another.
    `java.lang.String` | `getId()` Gets the id for the code or annotation using this tag.
    `ITSItems` | `getITSItems()` Gets the ITS items associated with this object.
    `java.lang.String` | `getRef()` Gets the URI reference for this marker.
    `java.lang.Boolean` | `getTranslate()` Gets the translate property for this marker.
    `java.lang.String` | `getType()` Gets the type of the code or marker this tag represents.
    `java.lang.String` | `getValue()` Gets the value for this marker.
    `boolean` | `hasITSItem()` Indicates if the object has at least one ITS item.
    `boolean` | `isCode()` Indicates if this tag is for a code (`CTag`).
    `boolean` | `isMarker()` Indicates if this tag is for a marker (`MTag`).
    `void` | `setITSItems(ITSItems itsItems)` Sets the list of the ITS items associated with this object.
    `void` | `setRef(java.lang.String ref)` Sets the URI reference for this marker (for both opening/closing tags).
    `void` | `setTranslate(java.lang.Boolean translate)` Sets the translate property for this marker (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` | `setValue(java.lang.String value)` sets the value for this marker (for both opening/closing tags).

    - ### 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

    - #### TYPE_DEFAULT

          public static final java.lang.String TYPE_DEFAULT

      Default type of a marker.
      See Also:
        Constant Field Values

    - #### mc

          protected net.sf.okapi.lib.xliff2.core.MTagCommon mc

  - ### Constructor Detail

    - #### MTag

          public MTag(java.lang.String id,
              java.lang.String type)

      Creates a new opening tag for a marker.
      Parameters:
        `id` - the ID of the new marker.
        `type` - the type of the new marker (can be null for the default type).

    - #### MTag

          public MTag(MTag opposite)

      Creates a new opening or closing tag for a marker.
      Parameters:
        `opposite` - the counterpart tag to connect to this new opening or closing tag.

    - #### MTag

          public MTag(MTag original,
              MTag opposite)

      Copy constructor.
      Parameters:
        `original` - the existing `MTag` to duplicate.
        `opposite` - the opposite tag to allow connecting the new created tag with its counterpart.

  - ### Method Detail

    - #### 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 interface `IWithITSAttributes`
      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.

    - #### getRef

          public java.lang.String getRef()

      Gets the URI reference for this marker.
      Returns:
        the URI reference for this marker (can be null).

    - #### setRef

          public void setRef(java.lang.String ref)

      Sets the URI reference for this marker (for both opening/closing tags).
      Parameters:
        `ref` - the new URI reference for this marker (can be null).

    - #### getValue

          public java.lang.String getValue()

      Gets the value for this marker.
      Returns:
        the value for this marker (can be null).

    - #### setValue

          public void setValue(java.lang.String value)

      sets the value for this marker (for both opening/closing tags).
      Parameters:
        `value` - the new value for this marker.

    - #### getTranslate

          public java.lang.Boolean getTranslate()

      Gets the translate property for this marker.
      Returns:
        the translate property for this marker (can be null).

    - #### setTranslate

          public void setTranslate(java.lang.Boolean translate)

      Sets the translate property for this marker (for both opening/closing tags).
      Parameters:
        `translate` - the new translate property (can be null).

    - #### 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.

    - #### 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`).

    - #### 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`).

    - #### hasITSItem

          public boolean hasITSItem()

      Description copied from interface: `IWithITSAttributes`
      Indicates if the object has at least one ITS item.
      Specified by:
        `hasITSItem` in interface `IWithITSAttributes`
      Returns:
        true if the object has at least one ITS item.

    - #### getITSItems

          public ITSItems getITSItems()

      Description copied from interface: `IWithITSAttributes`
      Gets the ITS items associated with this object.
      Specified by:
        `getITSItems` in interface `IWithITSAttributes`
      Returns:
        the ITS items associated with this object (can be empty, but never null).

    - #### setITSItems

          public void setITSItems(ITSItems itsItems)

      Description copied from interface: `IWithITSAttributes`
      Sets the list of the ITS items associated with this object.
      Specified by:
        `setITSItems` in interface `IWithITSAttributes`
      Parameters:
        `itsItems` - the new items to set.