Class AnnotatorsRef


  • public class AnnotatorsRef
    extends Object
    Represents the ITS annotatorsRef value set.
    • 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​(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​(String dc,
                        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 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 String printDCIfDifferent​(String dcIdentifier,
                                                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 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 String get​(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​(StringBuilder out,
                                    String dc,
                                    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.