Change IncludedSuggestionRelevanceTag to using 'relevanceBoost'.

Sometimes there is no difference between 'relevance' and 'relevanceBoost',
for example for enum constants. But for primitive constants, there might
be multiple `double` constants, in different libraries with their own
different relevances. And it would be nice to keep relative relevances
of these libraries in primitive type constants.

R=brianwilkerson@google.com

Change-Id: I3641a4709e09f5c5dd979f5ca8df7b0235c708d2
Reviewed-on: https://dart-review.googlesource.com/c/92623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index f008fae..f7ed499 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -1584,7 +1584,7 @@
         <p>
           If an <tt>AvailableSuggestion</tt> has relevance tags that match more
           than one <tt>IncludedSuggestionRelevanceTag</tt>, the maximum
-          relevance is used.
+          relevance boost is used.
         </p>
       </dd></dl></dd></dl>
 <h2 class="domain"><a name="domain_search">search domain</a></h2>
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index c99128b..9f29f1a 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -6503,7 +6503,7 @@
    * of matching types.
    *
    * If an AvailableSuggestion has relevance tags that match more than one
-   * IncludedSuggestionRelevanceTag, the maximum relevance is used.
+   * IncludedSuggestionRelevanceTag, the maximum relevance boost is used.
    */
   List<IncludedSuggestionRelevanceTag> get includedSuggestionRelevanceTags =>
       _includedSuggestionRelevanceTags;
@@ -6518,7 +6518,7 @@
    * of matching types.
    *
    * If an AvailableSuggestion has relevance tags that match more than one
-   * IncludedSuggestionRelevanceTag, the maximum relevance is used.
+   * IncludedSuggestionRelevanceTag, the maximum relevance boost is used.
    */
   void set includedSuggestionRelevanceTags(
       List<IncludedSuggestionRelevanceTag> value) {
@@ -15971,7 +15971,7 @@
  *
  * {
  *   "tag": AvailableSuggestionRelevanceTag
- *   "relevance": int
+ *   "relevanceBoost": int
  * }
  *
  * Clients may not extend, implement or mix-in this class.
@@ -15979,7 +15979,7 @@
 class IncludedSuggestionRelevanceTag implements HasToJson {
   String _tag;
 
-  int _relevance;
+  int _relevanceBoost;
 
   /**
    * The opaque value of the tag.
@@ -15995,23 +15995,25 @@
   }
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a
-   * higher number indicates a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this
+   * tag, which is added to the relevance of the containing
+   * IncludedSuggestionSet.
    */
-  int get relevance => _relevance;
+  int get relevanceBoost => _relevanceBoost;
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a
-   * higher number indicates a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this
+   * tag, which is added to the relevance of the containing
+   * IncludedSuggestionSet.
    */
-  void set relevance(int value) {
+  void set relevanceBoost(int value) {
     assert(value != null);
-    this._relevance = value;
+    this._relevanceBoost = value;
   }
 
-  IncludedSuggestionRelevanceTag(String tag, int relevance) {
+  IncludedSuggestionRelevanceTag(String tag, int relevanceBoost) {
     this.tag = tag;
-    this.relevance = relevance;
+    this.relevanceBoost = relevanceBoost;
   }
 
   factory IncludedSuggestionRelevanceTag.fromJson(
@@ -16026,14 +16028,14 @@
       } else {
         throw jsonDecoder.mismatch(jsonPath, "tag");
       }
-      int relevance;
-      if (json.containsKey("relevance")) {
-        relevance =
-            jsonDecoder.decodeInt(jsonPath + ".relevance", json["relevance"]);
+      int relevanceBoost;
+      if (json.containsKey("relevanceBoost")) {
+        relevanceBoost = jsonDecoder.decodeInt(
+            jsonPath + ".relevanceBoost", json["relevanceBoost"]);
       } else {
-        throw jsonDecoder.mismatch(jsonPath, "relevance");
+        throw jsonDecoder.mismatch(jsonPath, "relevanceBoost");
       }
-      return new IncludedSuggestionRelevanceTag(tag, relevance);
+      return new IncludedSuggestionRelevanceTag(tag, relevanceBoost);
     } else {
       throw jsonDecoder.mismatch(
           jsonPath, "IncludedSuggestionRelevanceTag", json);
@@ -16044,7 +16046,7 @@
   Map<String, dynamic> toJson() {
     Map<String, dynamic> result = {};
     result["tag"] = tag;
-    result["relevance"] = relevance;
+    result["relevanceBoost"] = relevanceBoost;
     return result;
   }
 
@@ -16054,7 +16056,7 @@
   @override
   bool operator ==(other) {
     if (other is IncludedSuggestionRelevanceTag) {
-      return tag == other.tag && relevance == other.relevance;
+      return tag == other.tag && relevanceBoost == other.relevanceBoost;
     }
     return false;
   }
@@ -16063,7 +16065,7 @@
   int get hashCode {
     int hash = 0;
     hash = JenkinsSmiHash.combine(hash, tag.hashCode);
-    hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
+    hash = JenkinsSmiHash.combine(hash, relevanceBoost.hashCode);
     return JenkinsSmiHash.finish(hash);
   }
 }
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index 236dcb0..c536416 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -1220,7 +1220,7 @@
    *   relevance to suggestions of matching types.
    *
    *   If an AvailableSuggestion has relevance tags that match more than one
-   *   IncludedSuggestionRelevanceTag, the maximum relevance is used.
+   *   IncludedSuggestionRelevanceTag, the maximum relevance boost is used.
    */
   Stream<CompletionResultsParams> onCompletionResults;
 
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index ea75ad2..ef2ded9 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -950,12 +950,12 @@
  *
  * {
  *   "tag": AvailableSuggestionRelevanceTag
- *   "relevance": int
+ *   "relevanceBoost": int
  * }
  */
 final Matcher isIncludedSuggestionRelevanceTag = new LazyMatcher(() =>
     new MatchesJsonObject("IncludedSuggestionRelevanceTag",
-        {"tag": isAvailableSuggestionRelevanceTag, "relevance": isInt}));
+        {"tag": isAvailableSuggestionRelevanceTag, "relevanceBoost": isInt}));
 
 /**
  * IncludedSuggestionSet
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/IncludedSuggestionRelevanceTag.java b/pkg/analysis_server/tool/spec/generated/java/types/IncludedSuggestionRelevanceTag.java
index 51f021e..d079df2 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/IncludedSuggestionRelevanceTag.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/IncludedSuggestionRelevanceTag.java
@@ -43,17 +43,17 @@
   private final AvailableSuggestionRelevanceTag tag;
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a higher number indicates
-   * a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this tag, which is added to
+   * the relevance of the containing IncludedSuggestionSet.
    */
-  private final int relevance;
+  private final int relevanceBoost;
 
   /**
    * Constructor for {@link IncludedSuggestionRelevanceTag}.
    */
-  public IncludedSuggestionRelevanceTag(AvailableSuggestionRelevanceTag tag, int relevance) {
+  public IncludedSuggestionRelevanceTag(AvailableSuggestionRelevanceTag tag, int relevanceBoost) {
     this.tag = tag;
-    this.relevance = relevance;
+    this.relevanceBoost = relevanceBoost;
   }
 
   @Override
@@ -62,15 +62,15 @@
       IncludedSuggestionRelevanceTag other = (IncludedSuggestionRelevanceTag) obj;
       return
         ObjectUtilities.equals(other.tag, tag) &&
-        other.relevance == relevance;
+        other.relevanceBoost == relevanceBoost;
     }
     return false;
   }
 
   public static IncludedSuggestionRelevanceTag fromJson(JsonObject jsonObject) {
     AvailableSuggestionRelevanceTag tag = AvailableSuggestionRelevanceTag.fromJson(jsonObject.get("tag").getAsJsonObject());
-    int relevance = jsonObject.get("relevance").getAsInt();
-    return new IncludedSuggestionRelevanceTag(tag, relevance);
+    int relevanceBoost = jsonObject.get("relevanceBoost").getAsInt();
+    return new IncludedSuggestionRelevanceTag(tag, relevanceBoost);
   }
 
   public static List<IncludedSuggestionRelevanceTag> fromJsonArray(JsonArray jsonArray) {
@@ -86,11 +86,11 @@
   }
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a higher number indicates
-   * a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this tag, which is added to
+   * the relevance of the containing IncludedSuggestionSet.
    */
-  public int getRelevance() {
-    return relevance;
+  public int getRelevanceBoost() {
+    return relevanceBoost;
   }
 
   /**
@@ -104,14 +104,14 @@
   public int hashCode() {
     HashCodeBuilder builder = new HashCodeBuilder();
     builder.append(tag);
-    builder.append(relevance);
+    builder.append(relevanceBoost);
     return builder.toHashCode();
   }
 
   public JsonObject toJson() {
     JsonObject jsonObject = new JsonObject();
     jsonObject.add("tag", tag.toJson());
-    jsonObject.addProperty("relevance", relevance);
+    jsonObject.addProperty("relevanceBoost", relevanceBoost);
     return jsonObject;
   }
 
@@ -121,8 +121,8 @@
     builder.append("[");
     builder.append("tag=");
     builder.append(tag + ", ");
-    builder.append("relevance=");
-    builder.append(relevance);
+    builder.append("relevanceBoost=");
+    builder.append(relevanceBoost);
     builder.append("]");
     return builder.toString();
   }
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index b7e0802..fd11715 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -1606,7 +1606,7 @@
         <p>
           If an <tt>AvailableSuggestion</tt> has relevance tags that match more
           than one <tt>IncludedSuggestionRelevanceTag</tt>, the maximum
-          relevance is used.
+          relevance boost is used.
         </p>
       </field>
     </params>
@@ -3657,11 +3657,12 @@
           The opaque value of the tag.
         </p>
       </field>
-      <field name="relevance">
+      <field name="relevanceBoost">
         <ref>int</ref>
         <p>
-          The relevance of the completion suggestions that match this tag,
-          where a higher number indicates a higher relevance.
+          The boost to the relevance of the completion suggestions that match
+          this tag, which is added to the relevance of the containing
+          <tt>IncludedSuggestionSet</tt>.
         </p>
       </field>
     </object>
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 191db85..6d464ab 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -6503,7 +6503,7 @@
    * of matching types.
    *
    * If an AvailableSuggestion has relevance tags that match more than one
-   * IncludedSuggestionRelevanceTag, the maximum relevance is used.
+   * IncludedSuggestionRelevanceTag, the maximum relevance boost is used.
    */
   List<IncludedSuggestionRelevanceTag> get includedSuggestionRelevanceTags =>
       _includedSuggestionRelevanceTags;
@@ -6518,7 +6518,7 @@
    * of matching types.
    *
    * If an AvailableSuggestion has relevance tags that match more than one
-   * IncludedSuggestionRelevanceTag, the maximum relevance is used.
+   * IncludedSuggestionRelevanceTag, the maximum relevance boost is used.
    */
   void set includedSuggestionRelevanceTags(
       List<IncludedSuggestionRelevanceTag> value) {
@@ -15971,7 +15971,7 @@
  *
  * {
  *   "tag": AvailableSuggestionRelevanceTag
- *   "relevance": int
+ *   "relevanceBoost": int
  * }
  *
  * Clients may not extend, implement or mix-in this class.
@@ -15979,7 +15979,7 @@
 class IncludedSuggestionRelevanceTag implements HasToJson {
   String _tag;
 
-  int _relevance;
+  int _relevanceBoost;
 
   /**
    * The opaque value of the tag.
@@ -15995,23 +15995,25 @@
   }
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a
-   * higher number indicates a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this
+   * tag, which is added to the relevance of the containing
+   * IncludedSuggestionSet.
    */
-  int get relevance => _relevance;
+  int get relevanceBoost => _relevanceBoost;
 
   /**
-   * The relevance of the completion suggestions that match this tag, where a
-   * higher number indicates a higher relevance.
+   * The boost to the relevance of the completion suggestions that match this
+   * tag, which is added to the relevance of the containing
+   * IncludedSuggestionSet.
    */
-  void set relevance(int value) {
+  void set relevanceBoost(int value) {
     assert(value != null);
-    this._relevance = value;
+    this._relevanceBoost = value;
   }
 
-  IncludedSuggestionRelevanceTag(String tag, int relevance) {
+  IncludedSuggestionRelevanceTag(String tag, int relevanceBoost) {
     this.tag = tag;
-    this.relevance = relevance;
+    this.relevanceBoost = relevanceBoost;
   }
 
   factory IncludedSuggestionRelevanceTag.fromJson(
@@ -16026,14 +16028,14 @@
       } else {
         throw jsonDecoder.mismatch(jsonPath, "tag");
       }
-      int relevance;
-      if (json.containsKey("relevance")) {
-        relevance =
-            jsonDecoder.decodeInt(jsonPath + ".relevance", json["relevance"]);
+      int relevanceBoost;
+      if (json.containsKey("relevanceBoost")) {
+        relevanceBoost = jsonDecoder.decodeInt(
+            jsonPath + ".relevanceBoost", json["relevanceBoost"]);
       } else {
-        throw jsonDecoder.mismatch(jsonPath, "relevance");
+        throw jsonDecoder.mismatch(jsonPath, "relevanceBoost");
       }
-      return new IncludedSuggestionRelevanceTag(tag, relevance);
+      return new IncludedSuggestionRelevanceTag(tag, relevanceBoost);
     } else {
       throw jsonDecoder.mismatch(
           jsonPath, "IncludedSuggestionRelevanceTag", json);
@@ -16044,7 +16046,7 @@
   Map<String, dynamic> toJson() {
     Map<String, dynamic> result = {};
     result["tag"] = tag;
-    result["relevance"] = relevance;
+    result["relevanceBoost"] = relevanceBoost;
     return result;
   }
 
@@ -16054,7 +16056,7 @@
   @override
   bool operator ==(other) {
     if (other is IncludedSuggestionRelevanceTag) {
-      return tag == other.tag && relevance == other.relevance;
+      return tag == other.tag && relevanceBoost == other.relevanceBoost;
     }
     return false;
   }
@@ -16063,7 +16065,7 @@
   int get hashCode {
     int hash = 0;
     hash = JenkinsSmiHash.combine(hash, tag.hashCode);
-    hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
+    hash = JenkinsSmiHash.combine(hash, relevanceBoost.hashCode);
     return JenkinsSmiHash.finish(hash);
   }
 }