9package org.dartlang.analysis.server.protocol;
11import java.util.Arrays;
14import com.google.common.collect.Lists;
15import com.google.dart.server.utilities.general.JsonUtilities;
16import com.google.dart.server.utilities.general.ObjectUtilities;
17import com.google.gson.JsonArray;
18import com.google.gson.JsonElement;
19import com.google.gson.JsonObject;
20import com.google.gson.JsonPrimitive;
21import org.apache.commons.lang3.builder.HashCodeBuilder;
22import java.util.ArrayList;
23import java.util.Iterator;
24import org.apache.commons.lang3.StringUtils;
31@SuppressWarnings(
"unused")
57 this.element = element;
76 ObjectUtilities.
equals(other.element, element) &&
77 Arrays.equals(other.offsets,
offsets) &&
85 int[]
offsets = JsonUtilities.decodeIntArray(jsonObject.get(
"offsets").getAsJsonArray());
86 int length = jsonObject.get(
"length").getAsInt();
91 if (jsonArray ==
null) {
94 ArrayList<Occurrences> list =
new ArrayList<Occurrences>(jsonArray.size());
95 Iterator<JsonElement> iterator = jsonArray.iterator();
96 while (iterator.hasNext()) {
97 list.add(fromJson(iterator.next().getAsJsonObject()));
125 HashCodeBuilder
builder =
new HashCodeBuilder();
133 JsonObject jsonObject =
new JsonObject();
134 jsonObject.add(
"element", element.
toJson());
135 JsonArray jsonArrayOffsets =
new JsonArray();
137 jsonArrayOffsets.add(
new JsonPrimitive(elt));
139 jsonObject.add(
"offsets", jsonArrayOffsets);
140 jsonObject.addProperty(
"length",
length);
146 StringBuilder
builder =
new StringBuilder();
149 builder.append(element +
", ");
static Element fromJson(JsonObject jsonObject)
static List< Occurrences > fromJsonArray(JsonArray jsonArray)
static Occurrences fromJson(JsonObject jsonObject)
Occurrences(Element element, int[] offsets, int length)
boolean containsInclusive(int x)
boolean equals(Object obj)