Index: pkg/analysis_server/tool/spec/generated/java/types/ImplementedElement.java |
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/HighlightRegion.java b/pkg/analysis_server/tool/spec/generated/java/types/ImplementedElement.java |
similarity index 57% |
copy from pkg/analysis_server/tool/spec/generated/java/types/HighlightRegion.java |
copy to pkg/analysis_server/tool/spec/generated/java/types/ImplementedElement.java |
index 7a8e83c10ed273c9caea4929de546d3d29378ecf..750ae3e83628d0fb53842fbc6fbe235d90674877 100644 |
--- a/pkg/analysis_server/tool/spec/generated/java/types/HighlightRegion.java |
+++ b/pkg/analysis_server/tool/spec/generated/java/types/ImplementedElement.java |
@@ -32,69 +32,65 @@ import java.util.Iterator; |
import org.apache.commons.lang3.StringUtils; |
/** |
- * A description of a region that could have special highlighting associated with it. |
+ * A description of a class or class member that is implemented by other classes or class members. |
* |
* @coverage dart.server.generated.types |
*/ |
@SuppressWarnings("unused") |
-public class HighlightRegion { |
+public class ImplementedElement { |
- public static final HighlightRegion[] EMPTY_ARRAY = new HighlightRegion[0]; |
+ public static final ImplementedElement[] EMPTY_ARRAY = new ImplementedElement[0]; |
- public static final List<HighlightRegion> EMPTY_LIST = Lists.newArrayList(); |
+ public static final List<ImplementedElement> EMPTY_LIST = Lists.newArrayList(); |
/** |
- * The type of highlight associated with the region. |
+ * The offset of the name of the implemented element. |
*/ |
- private final String type; |
+ private final int offset; |
/** |
- * The offset of the region to be highlighted. |
+ * The length of the name of the implemented element. |
*/ |
- private final int offset; |
+ private final int length; |
/** |
- * The length of the region to be highlighted. |
+ * The classes or class members that implement this element. |
*/ |
- private final int length; |
+ private final List<Implementation> implementations; |
/** |
- * Constructor for {@link HighlightRegion}. |
+ * Constructor for {@link ImplementedElement}. |
*/ |
- public HighlightRegion(String type, int offset, int length) { |
- this.type = type; |
+ public ImplementedElement(int offset, int length, List<Implementation> implementations) { |
this.offset = offset; |
this.length = length; |
- } |
- |
- public boolean containsInclusive(int x) { |
- return offset <= x && x <= offset + length; |
+ this.implementations = implementations; |
} |
@Override |
public boolean equals(Object obj) { |
- if (obj instanceof HighlightRegion) { |
- HighlightRegion other = (HighlightRegion) obj; |
+ if (obj instanceof ImplementedElement) { |
+ ImplementedElement other = (ImplementedElement) obj; |
return |
- ObjectUtilities.equals(other.type, type) && |
other.offset == offset && |
- other.length == length; |
+ other.length == length && |
+ ObjectUtilities.equals(other.implementations, implementations); |
} |
return false; |
} |
- public static HighlightRegion fromJson(JsonObject jsonObject) { |
- String type = jsonObject.get("type").getAsString(); |
+ public static ImplementedElement fromJson(JsonObject jsonObject) { |
int offset = jsonObject.get("offset").getAsInt(); |
int length = jsonObject.get("length").getAsInt(); |
- return new HighlightRegion(type, offset, length); |
+ List<Implementation> implementations = jsonObject.get("implementations") == null ? null : Implementation.fromJsonArray(jsonObject.get("implementations").getAsJsonArray()); |
+ return new ImplementedElement(offset, length, implementations); |
} |
- public static List<HighlightRegion> fromJsonArray(JsonArray jsonArray) { |
+ public static List<ImplementedElement> fromJsonArray(JsonArray jsonArray) { |
if (jsonArray == null) { |
return EMPTY_LIST; |
} |
- ArrayList<HighlightRegion> list = new ArrayList<HighlightRegion>(jsonArray.size()); |
+ ArrayList<ImplementedElement> list = new ArrayList<ImplementedElement>(jsonArray.size()); |
Iterator<JsonElement> iterator = jsonArray.iterator(); |
while (iterator.hasNext()) { |
list.add(fromJson(iterator.next().getAsJsonObject())); |
@@ -103,40 +99,46 @@ public class HighlightRegion { |
} |
/** |
- * The length of the region to be highlighted. |
+ * The classes or class members that implement this element. |
*/ |
- public int getLength() { |
- return length; |
+ public List<Implementation> getImplementations() { |
+ return implementations; |
} |
/** |
- * The offset of the region to be highlighted. |
+ * The length of the name of the implemented element. |
*/ |
- public int getOffset() { |
- return offset; |
+ public int getLength() { |
+ return length; |
} |
/** |
- * The type of highlight associated with the region. |
+ * The offset of the name of the implemented element. |
*/ |
- public String getType() { |
- return type; |
+ public int getOffset() { |
+ return offset; |
} |
@Override |
public int hashCode() { |
HashCodeBuilder builder = new HashCodeBuilder(); |
- builder.append(type); |
builder.append(offset); |
builder.append(length); |
+ builder.append(implementations); |
return builder.toHashCode(); |
} |
public JsonObject toJson() { |
JsonObject jsonObject = new JsonObject(); |
- jsonObject.addProperty("type", type); |
jsonObject.addProperty("offset", offset); |
jsonObject.addProperty("length", length); |
+ if (implementations != null) { |
+ JsonArray jsonArrayImplementations = new JsonArray(); |
+ for (Implementation elt : implementations) { |
+ jsonArrayImplementations.add(elt.toJson()); |
+ } |
+ jsonObject.add("implementations", jsonArrayImplementations); |
+ } |
return jsonObject; |
} |
@@ -144,12 +146,12 @@ public class HighlightRegion { |
public String toString() { |
StringBuilder builder = new StringBuilder(); |
builder.append("["); |
- builder.append("type="); |
- builder.append(type + ", "); |
builder.append("offset="); |
builder.append(offset + ", "); |
builder.append("length="); |
- builder.append(length); |
+ builder.append(length + ", "); |
+ builder.append("implementations="); |
+ builder.append(StringUtils.join(implementations, ", ")); |
builder.append("]"); |
return builder.toString(); |
} |