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")
59 private int codeOffset;
64 private int codeLength;
75 this.element = element;
78 this.codeOffset = codeOffset;
79 this.codeLength = codeLength;
91 ObjectUtilities.
equals(other.element, element) &&
94 other.codeOffset == codeOffset &&
95 other.codeLength == codeLength &&
96 ObjectUtilities.equals(other.children, children);
102 JsonObject elementObject = outlineObject.get(
"element").getAsJsonObject();
104 int offset = outlineObject.get(
"offset").getAsInt();
105 int length = outlineObject.get(
"length").getAsInt();
106 int codeOffset = outlineObject.get(
"codeOffset").getAsInt();
107 int codeLength = outlineObject.get(
"codeLength").getAsInt();
114 JsonElement childrenJsonArray = outlineObject.get(
"children");
115 if (childrenJsonArray instanceof JsonArray) {
116 Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
117 while (childrenElementIterator.hasNext()) {
118 JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
119 childrenList.
add(fromJson(outline, childObject));
178 HashCodeBuilder builder =
new HashCodeBuilder();
179 builder.append(element);
182 builder.append(codeOffset);
183 builder.append(codeLength);
184 builder.append(children);
185 return builder.toHashCode();
193 this.children = children;
200 this.codeLength = codeLength;
208 this.codeOffset = codeOffset;
215 this.element = element;
236 StringBuilder builder =
new StringBuilder();
238 builder.append(
"element=");
239 builder.append(element +
", ");
240 builder.append(
"offset=");
241 builder.append(
offset +
", ");
242 builder.append(
"length=");
243 builder.append(
length +
", ");
244 builder.append(
"codeOffset=");
245 builder.append(codeOffset +
", ");
246 builder.append(
"codeLength=");
247 builder.append(codeLength +
", ");
248 builder.append(
"children=");
249 builder.append(StringUtils.join(children,
", "));
251 return builder.toString();
void add(sk_sp< SkIDChangeListener > listener) SK_EXCLUDES(fMutex)
static Element fromJson(JsonObject jsonObject)
void setCodeLength(int codeLength)
static Outline fromJson(Outline parent, JsonObject outlineObject)
void setChildren(List< Outline > children)
List< Outline > getChildren()
void setOffset(int offset)
boolean containsInclusive(int x)
void setLength(int length)
void setCodeOffset(int codeOffset)
boolean equals(Object obj)
void setElement(Element element)
Outline(Outline parent, Element element, int offset, int length, int codeOffset, int codeLength)