Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: pkg/analysis_server/tool/spec/generated/java/types/ContextData.java

Issue 1416093007: Experimental `getDiagnostics` request (#24480). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review fixes. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015, the Dart project authors.
3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
11 * or implied. See the License for the specific language governing permissions a nd limitations under
12 * the License.
13 *
14 * This file has been automatically generated. Please do not edit it manually.
15 * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generat e_files".
16 */
17 package org.dartlang.analysis.server.protocol;
18
19 import java.util.Arrays;
20 import java.util.List;
21 import java.util.Map;
22 import com.google.common.collect.Lists;
23 import com.google.dart.server.utilities.general.JsonUtilities;
24 import com.google.dart.server.utilities.general.ObjectUtilities;
25 import com.google.gson.JsonArray;
26 import com.google.gson.JsonElement;
27 import com.google.gson.JsonObject;
28 import com.google.gson.JsonPrimitive;
29 import org.apache.commons.lang3.builder.HashCodeBuilder;
30 import java.util.ArrayList;
31 import java.util.Iterator;
32 import org.apache.commons.lang3.StringUtils;
33
34 /**
35 * Information about an analysis context.
36 *
37 * @coverage dart.server.generated.types
38 */
39 @SuppressWarnings("unused")
40 public class ContextData {
41
42 public static final ContextData[] EMPTY_ARRAY = new ContextData[0];
43
44 public static final List<ContextData> EMPTY_LIST = Lists.newArrayList();
45
46 /**
47 * The name of the context.
48 */
49 private final String name;
50
51 /**
52 * Explicitly analyzed files.
53 */
54 private final int explicitFileCount;
55
56 /**
57 * Implicitly analyzed files.
58 */
59 private final int implicitFileCount;
60
61 /**
62 * The number of work items in the queue.
63 */
64 private final int workItemQueueLength;
65
66 /**
67 * Exceptions associated with cache entries.
68 */
69 private final List<String> cacheEntryExceptions;
70
71 /**
72 * Constructor for {@link ContextData}.
73 */
74 public ContextData(String name, int explicitFileCount, int implicitFileCount, int workItemQueueLength, List<String> cacheEntryExceptions) {
75 this.name = name;
76 this.explicitFileCount = explicitFileCount;
77 this.implicitFileCount = implicitFileCount;
78 this.workItemQueueLength = workItemQueueLength;
79 this.cacheEntryExceptions = cacheEntryExceptions;
80 }
81
82 @Override
83 public boolean equals(Object obj) {
84 if (obj instanceof ContextData) {
85 ContextData other = (ContextData) obj;
86 return
87 ObjectUtilities.equals(other.name, name) &&
88 other.explicitFileCount == explicitFileCount &&
89 other.implicitFileCount == implicitFileCount &&
90 other.workItemQueueLength == workItemQueueLength &&
91 ObjectUtilities.equals(other.cacheEntryExceptions, cacheEntryExceptions) ;
92 }
93 return false;
94 }
95
96 public static ContextData fromJson(JsonObject jsonObject) {
97 String name = jsonObject.get("name").getAsString();
98 int explicitFileCount = jsonObject.get("explicitFileCount").getAsInt();
99 int implicitFileCount = jsonObject.get("implicitFileCount").getAsInt();
100 int workItemQueueLength = jsonObject.get("workItemQueueLength").getAsInt();
101 List<String> cacheEntryExceptions = JsonUtilities.decodeStringList(jsonObjec t.get("cacheEntryExceptions").getAsJsonArray());
102 return new ContextData(name, explicitFileCount, implicitFileCount, workItemQ ueueLength, cacheEntryExceptions);
103 }
104
105 public static List<ContextData> fromJsonArray(JsonArray jsonArray) {
106 if (jsonArray == null) {
107 return EMPTY_LIST;
108 }
109 ArrayList<ContextData> list = new ArrayList<ContextData>(jsonArray.size());
110 Iterator<JsonElement> iterator = jsonArray.iterator();
111 while (iterator.hasNext()) {
112 list.add(fromJson(iterator.next().getAsJsonObject()));
113 }
114 return list;
115 }
116
117 /**
118 * Exceptions associated with cache entries.
119 */
120 public List<String> getCacheEntryExceptions() {
121 return cacheEntryExceptions;
122 }
123
124 /**
125 * Explicitly analyzed files.
126 */
127 public int getExplicitFileCount() {
128 return explicitFileCount;
129 }
130
131 /**
132 * Implicitly analyzed files.
133 */
134 public int getImplicitFileCount() {
135 return implicitFileCount;
136 }
137
138 /**
139 * The name of the context.
140 */
141 public String getName() {
142 return name;
143 }
144
145 /**
146 * The number of work items in the queue.
147 */
148 public int getWorkItemQueueLength() {
149 return workItemQueueLength;
150 }
151
152 @Override
153 public int hashCode() {
154 HashCodeBuilder builder = new HashCodeBuilder();
155 builder.append(name);
156 builder.append(explicitFileCount);
157 builder.append(implicitFileCount);
158 builder.append(workItemQueueLength);
159 builder.append(cacheEntryExceptions);
160 return builder.toHashCode();
161 }
162
163 public JsonObject toJson() {
164 JsonObject jsonObject = new JsonObject();
165 jsonObject.addProperty("name", name);
166 jsonObject.addProperty("explicitFileCount", explicitFileCount);
167 jsonObject.addProperty("implicitFileCount", implicitFileCount);
168 jsonObject.addProperty("workItemQueueLength", workItemQueueLength);
169 JsonArray jsonArrayCacheEntryExceptions = new JsonArray();
170 for (String elt : cacheEntryExceptions) {
171 jsonArrayCacheEntryExceptions.add(new JsonPrimitive(elt));
172 }
173 jsonObject.add("cacheEntryExceptions", jsonArrayCacheEntryExceptions);
174 return jsonObject;
175 }
176
177 @Override
178 public String toString() {
179 StringBuilder builder = new StringBuilder();
180 builder.append("[");
181 builder.append("name=");
182 builder.append(name + ", ");
183 builder.append("explicitFileCount=");
184 builder.append(explicitFileCount + ", ");
185 builder.append("implicitFileCount=");
186 builder.append(implicitFileCount + ", ");
187 builder.append("workItemQueueLength=");
188 builder.append(workItemQueueLength + ", ");
189 builder.append("cacheEntryExceptions=");
190 builder.append(StringUtils.join(cacheEntryExceptions, ", "));
191 builder.append("]");
192 return builder.toString();
193 }
194
195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698