net.sf.okapi.lib.xliff2.its

## Class TermTag

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

- All Implemented Interfaces:
    IWithExtAttributes, IWithITSAttributes

      public class TermTag
      extends MTag

  Implements the XLIFF term annotation and the ITS Terminology data category.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `TYPE_ITSTERMNO`
    `static java.lang.String` | `TYPE_TERM`

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

      `mc, TYPE_DEFAULT`

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

      `tagType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TermTag(MTag tag, java.lang.String type, AnnotatorsRef ar)` Creates a new opening `TermTag` object from an existing marker tag.
    `TermTag(java.lang.String id)` Creates a new `TermTag` object.
    `TermTag(TermTag original)` Copy constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAnnotatorRef()` Gets the annotator reference currently set for this data category.
    `java.lang.String` | `getDataCategoryName()` Gets the the id/name of this data category.
    `ITSItems` | `getITSItems()` This method always return null: Only the Terminology data category can be used on a term annotation.
    `java.lang.Double` | `getTermConfidence()` Gets the confidence on whether this is a term or not.
    `java.lang.String` | `getTermInfo()` Gets the term information for this marker.
    `java.lang.String` | `getTermInfoRef()` Gets the term information reference for this marker.
    `boolean` | `hasITSItem()` Indicates if the object has at least one ITS item.
    `boolean` | `isTerm()` Indicates if this is a term.
    `void` | `setAnnotatorRef(AnnotatorsRef ar)` Sets the annotator reference information for this data category.
    `void` | `setAnnotatorRef(java.lang.String annotatorRef)` Sets the annotator reference information for this data category.
    `void` | `setITSItems(ITSItems itsItems)` This method always throws an UnsupportedOperationException exception: Only the Terminology data category can be used on a term annotation.
    `void` | `setTerm(boolean term)` Sets the flag indicating if this is a term.
    `void` | `setTermConfidence(java.lang.Double termConfidence)` Sets the confidence on whether this is a term or not.
    `void` | `setTermInfo(java.lang.String termInfo)` Sets the term information for this marker.
    `void` | `setTermInfoRef(java.lang.String termInfoRef)` Sets the term information reference for this marker.
    `void` | `setType(java.lang.String type)` Sets the type of the code or marker (for both opening/closing tags).
    `void` | `validate()` Validates this data category.

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

      `equals, getId, getRef, getTranslate, getType, getValue, isCode, isMarker, setRef, setTranslate, setValue`

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

          public static final java.lang.String TYPE_TERM

      See Also:
        Constant Field Values

    - #### TYPE_ITSTERMNO

          public static final java.lang.String TYPE_ITSTERMNO

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TermTag

          public TermTag(TermTag original)

      Copy constructor.
      Parameters:
        `original` - the original object to duplicate.

    - #### TermTag

          public TermTag(java.lang.String id)

      Creates a new `TermTag` object.
      Parameters:
        `id` - the id of the new term tag (cannot be null).

    - #### TermTag

          public TermTag(MTag tag,
                 java.lang.String type,
                 AnnotatorsRef ar)

      Creates a new opening `TermTag` object from an existing marker tag.
      Parameters:
        `tag` - the marker tag to use.
        `type` - the type of the annotation.
        `ar` - the annotator-references for this marker (can be null).

  - ### Method Detail

    - #### getDataCategoryName

          public java.lang.String getDataCategoryName()

      Gets the the id/name of this data category.
      Returns:
        the id/name of this data category.

    - #### validate

          public void validate()

      Validates this data category.

    - #### 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).
      Overrides:
        `setType` in class `MTag`
      Parameters:
        `type` - the type of the code or marker this tag represents.

    - #### isTerm

          public boolean isTerm()

      Indicates if this is a term.
      Returns:
        true if this annotation is a term, false otherwise.

    - #### setTerm

          public void setTerm(boolean term)

      Sets the flag indicating if this is a term.
      Parameters:
        `term` - true if this is a term, false otherwise.

    - #### getTermConfidence

          public java.lang.Double getTermConfidence()

      Gets the confidence on whether this is a term or not.
      Returns:
        the confidence on whether this is a term or not.

    - #### setTermConfidence

          public void setTermConfidence(java.lang.Double termConfidence)

      Sets the confidence on whether this is a term or not.
      Parameters:
        `termConfidence` - the confidence on whether this is a term or not (between 0.0 and 1.0).

    - #### 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`
      Overrides:
        `hasITSItem` in class `MTag`
      Returns:
        true if the object has at least one ITS item.

    - #### getITSItems

          public ITSItems getITSItems()

      This method always return null: Only the Terminology data category can be used on a term annotation.
      Specified by:
        `getITSItems` in interface `IWithITSAttributes`
      Overrides:
        `getITSItems` in class `MTag`
      Returns:
        always null

    - #### setITSItems

          public void setITSItems(ITSItems itsItems)

      This method always throws an UnsupportedOperationException exception: Only the Terminology data category can be used on a term annotation.
      Specified by:
        `setITSItems` in interface `IWithITSAttributes`
      Overrides:
        `setITSItems` in class `MTag`
      Parameters:
        `itsItems` - the new items to set.
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### setAnnotatorRef

          public void setAnnotatorRef(java.lang.String annotatorRef)

      Sets the annotator reference information for this data category.
      Parameters:
        `annotatorRef` - the reference string to set (can be null).

    - #### setAnnotatorRef

          public void setAnnotatorRef(AnnotatorsRef ar)

      Sets the annotator reference information for this data category.
      Parameters:
        `ar` - the set of references read from `its:annotatorsRef`. If it is null, or if there is no reference for the relevant data category: no change is made.

    - #### getAnnotatorRef

          public java.lang.String getAnnotatorRef()

      Gets the annotator reference currently set for this data category.
      Returns:
        the annotator reference currently set for this data category.

    - #### getTermInfo

          public java.lang.String getTermInfo()

      Gets the term information for this marker. This is the same as calling `MTag.getValue()`.
      Returns:
        the term information for this marker (can be null).

    - #### setTermInfo

          public void setTermInfo(java.lang.String termInfo)

      Sets the term information for this marker. Note that this call automatically calls `setRef(null);` because ITS terms can have only either a reference or a value but not both.
      Parameters:
        `termInfo` - the new information to set (can be null).

    - #### getTermInfoRef

          public java.lang.String getTermInfoRef()

      Gets the term information reference for this marker. This is the same as calling `MTag.getRef()`.
      Returns:
        the term information reference for this marker (can be null).

    - #### setTermInfoRef

          public void setTermInfoRef(java.lang.String termInfoRef)

      Sets the term information reference for this marker. Note that this call automatically calls `setValue(null);` because ITS terms can have only either a reference or a value but not both.
      Parameters:
        `termInfoRef` - the new information reference to set.