Package 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 Description static StringTYPE_ITSTERMNOstatic StringTYPE_TERM-
Fields inherited from class net.sf.okapi.lib.xliff2.core.MTag
mc, TYPE_DEFAULT
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)Indicates if this tag is equal to another.StringgetAnnotatorRef()Gets the annotator reference currently set for this data category.StringgetDataCategoryName()Gets the the id/name of this data category.ITSItemsgetITSItems()This method always return null: Only the Terminology data category can be used on a term annotation.DoublegetTermConfidence()Gets the confidence on whether this is a term or not.StringgetTermInfo()Gets the term information for this marker.StringgetTermInfoRef()Gets the term information reference for this marker.inthashCode()booleanhasITSItem()Indicates if the object has at least one ITS item.booleanisTerm()Indicates if this is a term.voidsetAnnotatorRef(String annotatorRef)Sets the annotator reference information for this data category.voidsetAnnotatorRef(AnnotatorsRef ar)Sets the annotator reference information for this data category.voidsetITSItems(ITSItems itsItems)This method always throws an UnsupportedOperationException exception: Only the Terminology data category can be used on a term annotation.voidsetTerm(boolean term)Sets the flag indicating if this is a term.voidsetTermConfidence(Double termConfidence)Sets the confidence on whether this is a term or not.voidsetTermInfo(String termInfo)Sets the term information for this marker.voidsetTermInfoRef(String termInfoRef)Sets the term information reference for this marker.voidsetType(String type)Sets the type of the code or marker (for both opening/closing tags).voidvalidate()Validates this data category.-
Methods inherited from class net.sf.okapi.lib.xliff2.core.MTag
getId, getRef, getTranslate, getType, getValue, isCode, isMarker, setRef, setTagType, 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
-
-
-
-
Field Detail
-
TYPE_TERM
public static final String TYPE_TERM
- See Also:
- Constant Field Values
-
TYPE_ITSTERMNO
public static final 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(String id)
Creates a newTermTagobject.- Parameters:
id- the id of the new term tag (cannot be null).
-
TermTag
public TermTag(MTag tag, String type, AnnotatorsRef ar)
Creates a new openingTermTagobject 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 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(String type)
Description copied from class:TagSets the type of the code or marker (for both opening/closing tags).
-
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 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(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:IWithITSAttributesIndicates if the object has at least one ITS item.- Specified by:
hasITSItemin interfaceIWithITSAttributes- Overrides:
hasITSItemin classMTag- 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:
getITSItemsin interfaceIWithITSAttributes- Overrides:
getITSItemsin classMTag- 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:
setITSItemsin interfaceIWithITSAttributes- Overrides:
setITSItemsin classMTag- Parameters:
itsItems- the new items to set.- Throws:
UnsupportedOperationException- in all cases.
-
setAnnotatorRef
public void setAnnotatorRef(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 fromits:annotatorsRef. If it is null, or if there is no reference for the relevant data category: no change is made.
-
getAnnotatorRef
public String getAnnotatorRef()
Gets the annotator reference currently set for this data category.- Returns:
- the annotator reference currently set for this data category.
-
getTermInfo
public String getTermInfo()
Gets the term information for this marker. This is the same as callingMTag.getValue().- Returns:
- the term information for this marker (can be null).
-
setTermInfo
public void setTermInfo(String termInfo)
Sets the term information for this marker. Note that this call automatically callssetRef(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 String getTermInfoRef()
Gets the term information reference for this marker. This is the same as callingMTag.getRef().- Returns:
- the term information reference for this marker (can be null).
-
setTermInfoRef
public void setTermInfoRef(String termInfoRef)
Sets the term information reference for this marker. Note that this call automatically callssetValue(null);because ITS terms can have only either a reference or a value but not both.- Parameters:
termInfoRef- the new information reference to set.
-
equals
public boolean equals(Object other)
Description copied from class:TagIndicates if this tag is equal to another.Use the
==operator to test if two tags are the same.
-
-