Class 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 and MatchType
    Author:
    HaslamJD, HARGRAVEJE
    • 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 -
      • setMatchType

        public void setMatchType​(MatchType matchType)
        Set the Tmhit's MatchType
        Parameters:
        matchType -
      • setCodeMismatch

        public void setCodeMismatch​(boolean codeMismatch)
        Set true of the Codes between the TmHit and query TextFragment are different.
        Parameters:
        codeMismatch -
      • isCodeMismatch

        public boolean isCodeMismatch()
        Is there a difference between the Codes of the TmHit and the query TextFragment?
        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:
        compareTo in interface Comparable<TmHit>
        Parameters:
        other - - the TmHit we are comparing against.
      • equals

        public boolean equals​(Object other)
        Define equality of state.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        A class that overrides equals must also override hashCode.
        Overrides:
        hashCode in class Object