Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
org.dartlang.analysis.server.protocol.LinkedEditGroup Class Reference

Public Member Functions

 LinkedEditGroup (List< Position > positions, int length, List< LinkedEditSuggestion > suggestions)
 
boolean equals (Object obj)
 
int getLength ()
 
List< PositiongetPositions ()
 
List< LinkedEditSuggestiongetSuggestions ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static LinkedEditGroup fromJson (JsonObject jsonObject)
 
static List< LinkedEditGroupfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final LinkedEditGroup[] EMPTY_ARRAY = new LinkedEditGroup[0]
 
static final List< LinkedEditGroupEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A collection of positions that should be linked (edited simultaneously) for the purposes of updating code after a source change. For example, if a set of edits introduced a new variable name, the group would contain all of the positions of the variable name so that if the client wanted to let the user edit the variable name after the operation, all occurrences of the name could be edited simultaneously.

Edit groups may have a length of 0 and function as tabstops where there is no default text, for example, an edit that inserts an if statement might provide an empty group between parens where a condition should be typed. For this reason, it's also valid for a group to contain only a single position that is not linked to others.

@coverage dart.server.generated.types

Definition at line 41 of file LinkedEditGroup.java.

Constructor & Destructor Documentation

◆ LinkedEditGroup()

org.dartlang.analysis.server.protocol.LinkedEditGroup.LinkedEditGroup ( List< Position positions,
int  length,
List< LinkedEditSuggestion suggestions 
)
inline

Constructor for LinkedEditGroup.

Definition at line 66 of file LinkedEditGroup.java.

66 {
67 this.positions = positions;
68 this.length = length;
69 this.suggestions = suggestions;
70 }

Member Function Documentation

◆ equals()

boolean org.dartlang.analysis.server.protocol.LinkedEditGroup.equals ( Object  obj)
inline

Definition at line 73 of file LinkedEditGroup.java.

73 {
74 if (obj instanceof LinkedEditGroup) {
75 LinkedEditGroup other = (LinkedEditGroup) obj;
76 return
77 ObjectUtilities.equals(other.positions, positions) &&
78 other.length == length &&
79 ObjectUtilities.equals(other.suggestions, suggestions);
80 }
81 return false;
82 }
LinkedEditGroup(List< Position > positions, int length, List< LinkedEditSuggestion > suggestions)

◆ fromJson()

static LinkedEditGroup org.dartlang.analysis.server.protocol.LinkedEditGroup.fromJson ( JsonObject  jsonObject)
inlinestatic

Definition at line 84 of file LinkedEditGroup.java.

84 {
85 List<Position> positions = Position.fromJsonArray(jsonObject.get("positions").getAsJsonArray());
86 int length = jsonObject.get("length").getAsInt();
87 List<LinkedEditSuggestion> suggestions = LinkedEditSuggestion.fromJsonArray(jsonObject.get("suggestions").getAsJsonArray());
88 return new LinkedEditGroup(positions, length, suggestions);
89 }

◆ fromJsonArray()

static List< LinkedEditGroup > org.dartlang.analysis.server.protocol.LinkedEditGroup.fromJsonArray ( JsonArray  jsonArray)
inlinestatic

Definition at line 91 of file LinkedEditGroup.java.

91 {
92 if (jsonArray == null) {
93 return EMPTY_LIST;
94 }
95 ArrayList<LinkedEditGroup> list = new ArrayList<LinkedEditGroup>(jsonArray.size());
96 Iterator<JsonElement> iterator = jsonArray.iterator();
97 while (iterator.hasNext()) {
98 list.add(fromJson(iterator.next().getAsJsonObject()));
99 }
100 return list;
101 }
static final List< LinkedEditGroup > EMPTY_LIST
static LinkedEditGroup fromJson(JsonObject jsonObject)

◆ getLength()

int org.dartlang.analysis.server.protocol.LinkedEditGroup.getLength ( )
inline

The length of the regions that should be edited simultaneously.

Definition at line 106 of file LinkedEditGroup.java.

106 {
107 return length;
108 }

◆ getPositions()

List< Position > org.dartlang.analysis.server.protocol.LinkedEditGroup.getPositions ( )
inline

The positions of the regions (after applying the relevant edits) that should be edited simultaneously.

Definition at line 114 of file LinkedEditGroup.java.

114 {
115 return positions;
116 }

◆ getSuggestions()

List< LinkedEditSuggestion > org.dartlang.analysis.server.protocol.LinkedEditGroup.getSuggestions ( )
inline

Pre-computed suggestions for what every region might want to be changed to.

Definition at line 121 of file LinkedEditGroup.java.

121 {
122 return suggestions;
123 }

◆ hashCode()

int org.dartlang.analysis.server.protocol.LinkedEditGroup.hashCode ( )
inline

Definition at line 126 of file LinkedEditGroup.java.

126 {
127 HashCodeBuilder builder = new HashCodeBuilder();
128 builder.append(positions);
129 builder.append(length);
130 builder.append(suggestions);
131 return builder.toHashCode();
132 }

◆ toJson()

JsonObject org.dartlang.analysis.server.protocol.LinkedEditGroup.toJson ( )
inline

Definition at line 134 of file LinkedEditGroup.java.

134 {
135 JsonObject jsonObject = new JsonObject();
136 JsonArray jsonArrayPositions = new JsonArray();
137 for (Position elt : positions) {
138 jsonArrayPositions.add(elt.toJson());
139 }
140 jsonObject.add("positions", jsonArrayPositions);
141 jsonObject.addProperty("length", length);
142 JsonArray jsonArraySuggestions = new JsonArray();
143 for (LinkedEditSuggestion elt : suggestions) {
144 jsonArraySuggestions.add(elt.toJson());
145 }
146 jsonObject.add("suggestions", jsonArraySuggestions);
147 return jsonObject;
148 }

◆ toString()

String org.dartlang.analysis.server.protocol.LinkedEditGroup.toString ( )
inline

Definition at line 151 of file LinkedEditGroup.java.

151 {
152 StringBuilder builder = new StringBuilder();
153 builder.append("[");
154 builder.append("positions=");
155 builder.append(StringUtils.join(positions, ", ") + ", ");
156 builder.append("length=");
157 builder.append(length + ", ");
158 builder.append("suggestions=");
159 builder.append(StringUtils.join(suggestions, ", "));
160 builder.append("]");
161 return builder.toString();
162 }

Member Data Documentation

◆ EMPTY_ARRAY

final LinkedEditGroup [] org.dartlang.analysis.server.protocol.LinkedEditGroup.EMPTY_ARRAY = new LinkedEditGroup[0]
static

Definition at line 43 of file LinkedEditGroup.java.

◆ EMPTY_LIST

final List<LinkedEditGroup> org.dartlang.analysis.server.protocol.LinkedEditGroup.EMPTY_LIST = Lists.newArrayList()
static

Definition at line 45 of file LinkedEditGroup.java.


The documentation for this class was generated from the following file: