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")
53 private final int[] targets;
63 this.targets = targets;
77 Arrays.equals(other.targets, targets);
83 int offset = jsonObject.get(
"offset").getAsInt();
84 int length = jsonObject.get(
"length").getAsInt();
85 int[] targets = JsonUtilities.decodeIntArray(jsonObject.get(
"targets").getAsJsonArray());
90 if (jsonArray ==
null) {
93 ArrayList<NavigationRegion> list =
new ArrayList<NavigationRegion>(jsonArray.size());
94 Iterator<JsonElement> iterator = jsonArray.iterator();
95 while (iterator.hasNext()) {
96 list.add(fromJson(iterator.next().getAsJsonObject()));
102 return targetObjects;
130 HashCodeBuilder
builder =
new HashCodeBuilder();
138 for (
int i = 0;
i < targets.length;
i++) {
139 int targetIndex = targets[
i];
141 targetObjects.add(
target);
146 JsonObject jsonObject =
new JsonObject();
147 jsonObject.addProperty(
"offset",
offset);
148 jsonObject.addProperty(
"length",
length);
149 JsonArray jsonArrayTargets =
new JsonArray();
150 for (
int elt : targets) {
151 jsonArrayTargets.add(
new JsonPrimitive(elt));
153 jsonObject.add(
"targets", jsonArrayTargets);
159 StringBuilder
builder =
new StringBuilder();
166 builder.append(StringUtils.join(targets,
", "));
static NavigationRegion fromJson(JsonObject jsonObject)
void lookupTargets(List< NavigationTarget > allTargets)
NavigationRegion(int offset, int length, int[] targets)
boolean equals(Object obj)
boolean containsInclusive(int x)
static List< NavigationRegion > fromJsonArray(JsonArray jsonArray)
List< NavigationTarget > getTargetObjects()