net.sf.okapi.lib.xliff2.its

## Class AnnotatorsRef

- java.lang.Object
- - net.sf.okapi.lib.xliff2.its.AnnotatorsRef

-     public class AnnotatorsRef
      extends java.lang.Object

  Represents the ITS annotatorsRef value set.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotatorsRef()` Creates an empty `AnnotatorsRef` object.
    `AnnotatorsRef(AnnotatorsRef original)` Copy constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `buildDCValue(java.lang.StringBuilder out, java.lang.String dc, java.lang.String value)` Adds if needed the annotator reference value for the given data category.
    `java.lang.String` | `get(java.lang.String name)` Gets the annotator reference value for a given data category.
    `boolean` | `isEmpty()` Indicates if this annotators set is empty or nor.
    `java.lang.String` | `print()` Outputs the annotator-references in this set.
    `static java.lang.String` | `printDCIfDifferent(java.lang.String dcIdentifier, java.lang.String value, AnnotatorsRef parentAR)` Compares a give annotator-reference value and parent's value for a given data category and output the value if it is difference form the parent's value or if the parent's value is null.
    `java.lang.String` | `printDifferences(AnnotatorsRef parentAR)` Output the annotator-references of this set that are not in a given parent set.
    `void` | `read(java.lang.String data)` Reads the annotatorsRef value into this object.
    `void` | `set(IITSItem item)` Sets the annotator reference of a given ITS item (if available).
    `void` | `set(java.lang.String dc, java.lang.String value)` Sets the annotator reference for a given data category.
    `static void` | `update(AnnotatorsRef ar, IWithITSAttributes object)` Update an `AnnotatorsRef` object with the values of the live object.

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

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

- - ### Constructor Detail

    - #### AnnotatorsRef

          public AnnotatorsRef()

      Creates an empty `AnnotatorsRef` object.

    - #### AnnotatorsRef

          public AnnotatorsRef(AnnotatorsRef original)

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

  - ### Method Detail

    - #### read

          public void read(java.lang.String data)

      Reads the annotatorsRef value into this object.
      Parameters:
        `data` - the string value of the its:annotatorsRef attribute.

    - #### set

          public void set(IITSItem item)

      Sets the annotator reference of a given ITS item (if available). If the item is null, or if it has no annotator reference, nothing is set.
      Parameters:
        `item` - the item where the new annotator reference may be (can be null).

    - #### set

          public void set(java.lang.String dc,
                 java.lang.String value)

      Sets the annotator reference for a given data category. If the value is null, the entry is not set.
      Parameters:
        `dc` - the data category.
        `value` - the value to set.

    - #### printDifferences

          public java.lang.String printDifferences(AnnotatorsRef parentAR)

      Output the annotator-references of this set that are not in a given parent set.
      Parameters:
        `parentAR` - the previous `AnnotatorsRef` object in the context (can be null if there is none).
      Returns:
        the ITS annotatorsRef attribute (can be empty but is never null).
      See Also:
        `print()`

    - #### printDCIfDifferent

          public static java.lang.String printDCIfDifferent(java.lang.String dcIdentifier,
                                            java.lang.String value,
                                            AnnotatorsRef parentAR)

      Compares a give annotator-reference value and parent's value for a given data category and output the value if it is difference form the parent's value or if the parent's value is null. If the value is null an empty string is output.
      Parameters:
        `dcIdentifier` - the data category identifier
        `value` - the annotator-reference value (can be null)
        `parentAR` - the annotator-reference parent (can be null)
      Returns:
        the given value as an annotator-reference or an empty string

    - #### update

          public static void update(AnnotatorsRef ar,
                    IWithITSAttributes object)

      Update an `AnnotatorsRef` object with the values of the live object. Values for data categories not in live object are left alone.
      Parameters:
        `ar` - the object to update.
        `object` - the live object from where to get the new values.

    - #### print

          public java.lang.String print()

      Outputs the annotator-references in this set.
      Returns:
        the its:annotatorsRef attribute for this set (all values)
      See Also:
        `printDifferences(AnnotatorsRef)`

    - #### get

          public java.lang.String get(java.lang.String name)

      Gets the annotator reference value for a given data category.
      Parameters:
        `name` - the name of the data category.
      Returns:
        the annotator reference for the given data category (can be null).

    - #### buildDCValue

          protected void buildDCValue(java.lang.StringBuilder out,
                          java.lang.String dc,
                          java.lang.String value)

      Adds if needed the annotator reference value for the given data category.
      Parameters:
        `out` - the buffer where to add the value.
        `dc` - the data category to lookup.
        `value` - the value to match with.

    - #### isEmpty

          public boolean isEmpty()

      Indicates if this annotators set is empty or nor.
      Returns:
        true if this annotators set is empty, false otherwise.