Record Class ScoreResult

java.lang.Object
java.lang.Record
cloud.opencode.base.rules.score.ScoreResult
Record Components:
totalScore - the aggregated total score | 聚合总分
ruleScores - per-rule scores (rule name to score) | 各规则分数(规则名称到分数)
strategy - the aggregation strategy used | 使用的聚合策略

public record ScoreResult(double totalScore, Map<String,Double> ruleScores, AggregationStrategy strategy) extends Record
Score Result - Aggregated Scoring Outcome from a Scoring Engine Run 评分结果 - 评分引擎运行的聚合评分结果

Contains the total aggregated score, individual per-rule scores, and the aggregation strategy used.

包含总聚合分数、各规则的单独分数以及使用的聚合策略。

Since:
JDK 25, opencode-base-rules V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ScoreResult

      public ScoreResult(double totalScore, Map<String,Double> ruleScores, AggregationStrategy strategy)
      Creates a ScoreResult with a defensive copy of the rule scores map 使用规则分数映射的防御性副本创建ScoreResult
      Parameters:
      totalScore - the total score | 总分
      ruleScores - the per-rule scores | 各规则分数
      strategy - the aggregation strategy | 聚合策略
  • Method Details

    • matchCount

      public int matchCount()
      Returns the number of rules that matched (scored) 返回匹配(评分)的规则数量
      Returns:
      match count | 匹配数量
    • topScoringRule

      public Optional<String> topScoringRule()
      Returns the name of the rule with the highest score 返回得分最高的规则名称
      Returns:
      optional containing the top-scoring rule name, empty if no rules scored | 包含最高分规则名称的Optional,如果没有规则评分则为空
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • totalScore

      public double totalScore()
      Returns the value of the totalScore record component.
      Returns:
      the value of the totalScore record component
    • ruleScores

      public Map<String,Double> ruleScores()
      Returns the value of the ruleScores record component.
      Returns:
      the value of the ruleScores record component
    • strategy

      public AggregationStrategy strategy()
      Returns the value of the strategy record component.
      Returns:
      the value of the strategy record component