Class QueryResult

    • Field Detail

      • QUALITY_UNDEFINED

        public static int QUALITY_UNDEFINED
      • COMBINEDSCORE_UNDEFINED

        public static int COMBINEDSCORE_UNDEFINED
      • weight

        public int weight
        Weight for this result.
      • source

        public TextFragment source
        Text of the source for this result.
      • target

        public TextFragment target
        Text of the target for this result.
      • creationDate

        public Date creationDate
        Creation date of TM entry
      • entryId

        public String entryId
        Unique id of this TM entry. Can be null.
      • connectorId

        public int connectorId
        ID of the connector that generated this result.
      • origin

        public String origin
        String indicating the origin of the result (e.g. name of a TM). This value can be null and depends on each type of resource.
      • engine

        public String engine
        String providing additional information about the origin. For MT system: this can store the engine identifier for example. The value can be null and depends on each type of resource.
    • Constructor Detail

      • QueryResult

        public QueryResult()
    • Method Detail

      • fromMT

        public boolean fromMT()
        Indicator telling if the result is coming from a machine translation engine or not.
        Returns:
        true if the result is coming from a machine translation engine, false otherwise.
      • getQuality

        public int getQuality()
        Gets the quality rating of the translation in this result.
        Returns:
        A value between 0 and 100, or QUALITY_UNDEFINED if no quality rating is set.
      • setQuality

        public void setQuality​(int quality)
        Sets the quality rating of the translation in this result Each connector is responsible for adjusting the original quality information (if any) to this scale.
        Parameters:
        quality - the new quality value (a value between 0 and 100, or QUALITY_UNDEFINED if the value is not defined.
        Throws:
        InvalidParameterException - if the parameter value is not valid.
      • getCombinedScore

        public int getCombinedScore()
        Gets the combined score for this result.
        Returns:
        the combined score for this result. If no combined score is set (default), this returns the "normal" score.
      • setCombinedScore

        public void setCombinedScore​(int combinedScore)
        Sets the combined score for this result.
        Parameters:
        combinedScore - the new combined score value.

        This is a re-calculated score to take into account quality (when available) (a value between 0 and 100, or COMBINEDSCORE_UNDEFINED if the value is not defined.

      • getFuzzyScore

        public int getFuzzyScore()
        Gets the fuzzy score (i.e., string distance) for this result.
        Returns:
        the score for this result.
        See Also:
        getCombinedScore()
      • setFuzzyScore

        public void setFuzzyScore​(int fuzzyScore)
        Sets the score for this result.
        Parameters:
        fuzzyScore - the new combined score value (normally a value between 0 and 100, but some systems can set higher scores).
      • compareTo

        public int compareTo​(QueryResult other)
        This method implements a five way sort on (1) weight (2) MatchType (3) Score (4) source string match and (5) creation date. Weight is the primary key, MatchType secondary, score tertiary and source string quaternary.
        Specified by:
        compareTo in interface Comparable<QueryResult>
        Parameters:
        other - the QueryResult we are comparing against.
        Returns:
        the comparison result (0 if both objects are equal).
      • equals

        public boolean equals​(Object other)
        Define equality of state. Note: this class has a natural ordering that is inconsistent with equals.
        Overrides:
        equals in class Object
        Parameters:
        other - the object to compare with.
        Returns:
        true if the objects are equal, false otherwise.
      • hashCode

        public int hashCode()
        A class that overrides equals must also override hashCode.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code for this object.