Package net.sf.okapi.common.annotation
Class TermsAnnotation
- java.lang.Object
-
- net.sf.okapi.common.annotation.TermsAnnotation
-
- All Implemented Interfaces:
Cloneable,IAnnotation
public class TermsAnnotation extends Object implements IAnnotation
Simple annotation for storing terms and their associated information.
-
-
Constructor Summary
Constructors Constructor Description TermsAnnotation()Creates a new empty TermsAnnotation object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String term, String info)Adds a term to the annotation.StringgetInfo(int index)Gets the term information for a given index, or an empty string if there is not associated information for the term.StringgetTerm(int index)Gets the term for a given index.booleanisEmpty()Returns true if there are terms in this annotation.intsize()Gets the number of terms in this annotation.StringtoString()Gets a human readable representation of this annotation.
-
-
-
Method Detail
-
add
public void add(String term, String info)
Adds a term to the annotation.- Parameters:
term- the term to add.info- the associated into (can be null).
-
size
public int size()
Gets the number of terms in this annotation.- Returns:
- the number of terms in this annotation.
-
isEmpty
public boolean isEmpty()
Returns true if there are terms in this annotation.- Returns:
- true if terms exist in this annotation.
-
getTerm
public String getTerm(int index)
Gets the term for a given index.- Parameters:
index- the index of the term to retrieve.- Returns:
- the term for a given index.
-
getInfo
public String getInfo(int index)
Gets the term information for a given index, or an empty string if there is not associated information for the term.- Parameters:
index- the index of the term information to retrieve.- Returns:
- the term information for a given index.
-
toString
public String toString()
Description copied from interface:IAnnotationGets a human readable representation of this annotation.- Specified by:
toStringin interfaceIAnnotation- Overrides:
toStringin classObject- Returns:
- a human readable representation of this annotation.
-
-