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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/InlineLocalVariableFeedback.java

Issue 542333002: Add feedback for 'Inline Local' refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/InlineLocalVariableFeedback.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/InlineLocalVariableFeedback.java
similarity index 56%
copy from editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
copy to editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/InlineLocalVariableFeedback.java
index a3341a5dda20ce9f65b83f9b5a02abe68874dd3c..e3d69da84bb7a3014a9855b0e5e1b47811fff727 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/InlineLocalVariableFeedback.java
@@ -32,57 +32,55 @@ import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
/**
- * A position within a file.
- *
* @coverage dart.server.generated.types
*/
@SuppressWarnings("unused")
-public class Position {
+public class InlineLocalVariableFeedback extends RefactoringFeedback {
- public static final Position[] EMPTY_ARRAY = new Position[0];
+ public static final InlineLocalVariableFeedback[] EMPTY_ARRAY = new InlineLocalVariableFeedback[0];
- public static final List<Position> EMPTY_LIST = Lists.newArrayList();
+ public static final List<InlineLocalVariableFeedback> EMPTY_LIST = Lists.newArrayList();
/**
- * The file containing the position.
+ * The name of the variable being inlined.
*/
- private final String file;
+ private final String name;
/**
- * The offset of the position.
+ * The number of times the variable occurs.
*/
- private final int offset;
+ private final int occurrences;
/**
- * Constructor for {@link Position}.
+ * Constructor for {@link InlineLocalVariableFeedback}.
*/
- public Position(String file, int offset) {
- this.file = file;
- this.offset = offset;
+ public InlineLocalVariableFeedback(String name, int occurrences) {
+ this.name = name;
+ this.occurrences = occurrences;
}
@Override
public boolean equals(Object obj) {
- if (obj instanceof Position) {
- Position other = (Position) obj;
+ if (obj instanceof InlineLocalVariableFeedback) {
+ InlineLocalVariableFeedback other = (InlineLocalVariableFeedback) obj;
return
- ObjectUtilities.equals(other.file, file) &&
- other.offset == offset;
+ ObjectUtilities.equals(other.name, name) &&
+ other.occurrences == occurrences;
}
return false;
}
- public static Position fromJson(JsonObject jsonObject) {
- String file = jsonObject.get("file").getAsString();
- int offset = jsonObject.get("offset").getAsInt();
- return new Position(file, offset);
+ public static InlineLocalVariableFeedback fromJson(JsonObject jsonObject) {
+ String name = jsonObject.get("name").getAsString();
+ int occurrences = jsonObject.get("occurrences").getAsInt();
+ return new InlineLocalVariableFeedback(name, occurrences);
}
- public static List<Position> fromJsonArray(JsonArray jsonArray) {
+ public static List<InlineLocalVariableFeedback> fromJsonArray(JsonArray jsonArray) {
if (jsonArray == null) {
return EMPTY_LIST;
}
- ArrayList<Position> list = new ArrayList<Position>(jsonArray.size());
+ ArrayList<InlineLocalVariableFeedback> list = new ArrayList<InlineLocalVariableFeedback>(jsonArray.size());
Iterator<JsonElement> iterator = jsonArray.iterator();
while (iterator.hasNext()) {
list.add(fromJson(iterator.next().getAsJsonObject()));
@@ -91,31 +89,31 @@ public class Position {
}
/**
- * The file containing the position.
+ * The name of the variable being inlined.
*/
- public String getFile() {
- return file;
+ public String getName() {
+ return name;
}
/**
- * The offset of the position.
+ * The number of times the variable occurs.
*/
- public int getOffset() {
- return offset;
+ public int getOccurrences() {
+ return occurrences;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
- builder.append(file);
- builder.append(offset);
+ builder.append(name);
+ builder.append(occurrences);
return builder.toHashCode();
}
public JsonObject toJson() {
JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty("file", file);
- jsonObject.addProperty("offset", offset);
+ jsonObject.addProperty("name", name);
+ jsonObject.addProperty("occurrences", occurrences);
return jsonObject;
}
@@ -123,10 +121,10 @@ public class Position {
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[");
- builder.append("file=");
- builder.append(file + ", ");
- builder.append("offset=");
- builder.append(offset);
+ builder.append("name=");
+ builder.append(name + ", ");
+ builder.append("occurrences=");
+ builder.append(occurrences);
builder.append("]");
return builder.toString();
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/remote/processor/GetRefactoringProcessor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698