Package net.sf.okapi.lib.xliff2.its
Class AnnotatorsRef
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.its.AnnotatorsRef
-
public class AnnotatorsRef extends Object
Represents the ITS annotatorsRef value set.
-
-
Constructor Summary
Constructors Constructor Description AnnotatorsRef()Creates an emptyAnnotatorsRefobject.AnnotatorsRef(AnnotatorsRef original)Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildDCValue(StringBuilder out, String dc, String value)Adds if needed the annotator reference value for the given data category.Stringget(String name)Gets the annotator reference value for a given data category.booleanisEmpty()Indicates if this annotators set is empty or nor.Stringprint()Outputs the annotator-references in this set.static StringprintDCIfDifferent(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.StringprintDifferences(AnnotatorsRef parentAR)Output the annotator-references of this set that are not in a given parent set.voidread(String data)Reads the annotatorsRef value into this object.voidset(String dc, String value)Sets the annotator reference for a given data category.voidset(IITSItem item)Sets the annotator reference of a given ITS item (if available).static voidupdate(AnnotatorsRef ar, IWithITSAttributes object)Update anAnnotatorsRefobject with the values of the live object.
-
-
-
Constructor Detail
-
AnnotatorsRef
public AnnotatorsRef()
Creates an emptyAnnotatorsRefobject.
-
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 previousAnnotatorsRefobject 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 identifiervalue- 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 anAnnotatorsRefobject 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.
-
-