Class SimilarityResult

    • Constructor Detail

      • SimilarityResult

        public SimilarityResult​(MethodSignature method1,
                                MethodSignature method2,
                                Map<SimilarityMetric,​Double> scores,
                                SimilarityMetric primaryMetric)
        Creates a result and derives the overall score from the primary metric, or a weighted average when the primary metric is COMBINED.
        Parameters:
        method1 - the first compared method
        method2 - the second compared method
        scores - the per-metric scores, copied
        primaryMetric - the metric that determines the overall score
    • Method Detail

      • getOverallScore

        public double getOverallScore()
        Returns:
        the overall score
      • getScorePercent

        public int getScorePercent()
        Returns:
        the overall score rounded to a 0-100 percentage
      • getPrimaryMetric

        public SimilarityMetric getPrimaryMetric()
        Returns:
        the primary metric
      • getScore

        public double getScore​(SimilarityMetric metric)
        Parameters:
        metric - the metric to read
        Returns:
        the score for that metric, or 0.0 if absent
      • isPotentialDuplicate

        public boolean isPotentialDuplicate()
        Returns:
        true if the overall score is at least 0.95
      • isHighlySimilar

        public boolean isHighlySimilar()
        Returns:
        true if the overall score is at least 0.80
      • getSummary

        public String getSummary()
        Returns:
        a short human-readable label of the similarity band with the percentage