Package net.sf.okapi.lib.xliff2.its
Class ITSItems
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.its.ITSItems
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IITSItem item)Adds (or sets) a new ITS data category instance in this collection.voidclear()Removes all entries in this collection.<A extends DataCategory>
IITSItemget(Class<A> dcType)Gets the item for a given type of data category.IITSItemget(String dcName)Gets the item for a given data category name.booleanisEmpty()Indicates if there is at least one entry in this collection.Iterator<IITSItem>iterator()Returns an iterator for the items in this collection.voidremove(IITSItem item)Removes a given item from this collection.intsize()Gets the number of distinct data categories in this collection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
add
public void add(IITSItem item)
Adds (or sets) a new ITS data category instance in this collection.- If the data category is always single instance (like MT Confidence) this method replaces any existing instance by the new one.
- If the data category allows for multiple instances (i.e. Provenance or Localization Quality Issue), this methods add the new instance. If an instance is already present, the existing instance is moved to a group and the new one is added to the group.
- Parameters:
item- the new item to set.
-
isEmpty
public boolean isEmpty()
Indicates if there is at least one entry in this collection.- Returns:
- true if there is at least one entry in this collection, false otherwise.
-
clear
public void clear()
Removes all entries in this collection.
-
remove
public void remove(IITSItem item)
Removes a given item from this collection. If the item is not found, nothing is done. For Provenance and Localization Quality Issue the item can be a group or an instance.- Parameters:
item- the item to remove.
-
size
public int size()
Gets the number of distinct data categories in this collection. Only one entry is counted for LocQualityIssue and Provenance, even if there are several.- Returns:
- the number of distinct data categories in this collection.
-
get
public IITSItem get(String dcName)
Gets the item for a given data category name. This method callsget(Class)after mapping the name to the class.- Parameters:
dcName- the name of the data category (as used in its:annotatorsRef).- Returns:
- Same as for
get(Class). - Throws:
InvalidParameterException- if the name is not valid.
-
get
public <A extends DataCategory> IITSItem get(Class<A> dcType)
Gets the item for a given type of data category.- Type Parameters:
A- the type of data category.- Parameters:
dcType- the data category type.- Returns:
- the item for the given type of data category, or null if there is none.
The item returned is a group if there are several instances for the given data category
(i.e. for multiple Provenance or Localization Quality Issue).
That is: you may get a
Provenancesor aLocQualityIssuesobject when you query for the classesProvenanceorLocQualityIssue.
-
-