Package net.sf.okapi.tm.pensieve.common
Class TmHit
- java.lang.Object
-
- net.sf.okapi.tm.pensieve.common.TmHit
-
- All Implemented Interfaces:
Comparable<TmHit>
public class TmHit extends Object implements Comparable<TmHit>
Represents a TM Hit. This stores a reference to the TranslationUnit and its score andMatchType- Author:
- HaslamJD, HARGRAVEJE
-
-
Constructor Summary
Constructors Constructor Description TmHit()Default constructor which sets the MatchType to NONE.TmHit(TranslationUnit tu, MatchType matchType, float score)Create a new TmHit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(TmHit other)This method implements a three way sort on (1) MatchType (2) score (3) source string.booleanequals(Object other)Define equality of state.intgetDocId()Get the document id for the TmHit.MatchTypegetMatchType()Get the Tmhit'sMatchTypefloatgetScore()Get the TmHit's score.TranslationUnitgetTu()Get the TmHit'sTranslationUnitinthashCode()A class that overrides equals must also override hashCode.booleanisCodeMismatch()Is there a difference between theCodes of the TmHit and the queryTextFragment?voidsetCodeMismatch(boolean codeMismatch)Set true of theCodes between the TmHit and queryTextFragmentare different.voidsetDocId(int docId)Set the document id for the TmHit.voidsetMatchType(MatchType matchType)Set the Tmhit'sMatchTypevoidsetScore(Float score)Set the TmHit's score.voidsetTu(TranslationUnit tu)Set the TmHit'sTranslationUnit
-
-
-
Constructor Detail
-
TmHit
public TmHit()
Default constructor which sets the MatchType to NONE.
-
TmHit
public TmHit(TranslationUnit tu, MatchType matchType, float score)
Create a new TmHit.- Parameters:
tu-matchType-score-
-
-
Method Detail
-
getScore
public float getScore()
Get the TmHit's score.- Returns:
- the score as a float normalized between 0 and 1.0
-
setScore
public void setScore(Float score)
Set the TmHit's score.- Parameters:
score-
-
getTu
public TranslationUnit getTu()
Get the TmHit'sTranslationUnit- Returns:
- a
TranslationUnit
-
setTu
public void setTu(TranslationUnit tu)
Set the TmHit'sTranslationUnit- Parameters:
tu-
-
setMatchType
public void setMatchType(MatchType matchType)
Set the Tmhit'sMatchType- Parameters:
matchType-
-
setCodeMismatch
public void setCodeMismatch(boolean codeMismatch)
Set true of theCodes between the TmHit and queryTextFragmentare different.- Parameters:
codeMismatch-
-
isCodeMismatch
public boolean isCodeMismatch()
Is there a difference between theCodes of the TmHit and the queryTextFragment?- Returns:
- true if there is a code difference.
-
setDocId
public void setDocId(int docId)
Set the document id for the TmHit. This is usually the Lucene document id.- Parameters:
docId-
-
getDocId
public int getDocId()
Get the document id for the TmHit. This is usually the Lucene document id.- Returns:
- integer specifying the TmHit's document id.
-
compareTo
public int compareTo(TmHit other)
This method implements a three way sort on (1) MatchType (2) score (3) source string. MatchType is the primary key, score secondary and source string tertiary.- Specified by:
compareToin interfaceComparable<TmHit>- Parameters:
other- - the TmHit we are comparing against.
-
equals
public boolean equals(Object other)
Define equality of state.
-
-