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

Public Member Functions

 Location (String file, int offset, int length, int startLine, int startColumn, Integer endLine, Integer endColumn)
 
boolean equals (Object obj)
 
Integer getEndColumn ()
 
Integer getEndLine ()
 
String getFile ()
 
int getLength ()
 
int getOffset ()
 
int getStartColumn ()
 
int getStartLine ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static Location fromJson (JsonObject jsonObject)
 
static List< LocationfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final Location[] EMPTY_ARRAY = new Location[0]
 
static final List< LocationEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A location (character range) within a file.

@coverage dart.server.generated.types

Definition at line 32 of file Location.java.

Constructor & Destructor Documentation

◆ Location()

org.dartlang.analysis.server.protocol.Location.Location ( String  file,
int  offset,
int  length,
int  startLine,
int  startColumn,
Integer  endLine,
Integer  endColumn 
)
inline

Constructor for Location.

Definition at line 76 of file Location.java.

76 {
77 this.file = file;
78 this.offset = offset;
79 this.length = length;
80 this.startLine = startLine;
81 this.startColumn = startColumn;
82 this.endLine = endLine;
83 this.endColumn = endColumn;
84 }

Member Function Documentation

◆ equals()

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

Definition at line 87 of file Location.java.

87 {
88 if (obj instanceof Location) {
89 Location other = (Location) obj;
90 return
91 ObjectUtilities.equals(other.file, file) &&
92 other.offset == offset &&
93 other.length == length &&
94 other.startLine == startLine &&
95 other.startColumn == startColumn &&
96 ObjectUtilities.equals(other.endLine, endLine) &&
97 ObjectUtilities.equals(other.endColumn, endColumn);
98 }
99 return false;
100 }
Location(String file, int offset, int length, int startLine, int startColumn, Integer endLine, Integer endColumn)
Definition: Location.java:76

◆ fromJson()

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

Definition at line 102 of file Location.java.

102 {
103 String file = jsonObject.get("file").getAsString();
104 int offset = jsonObject.get("offset").getAsInt();
105 int length = jsonObject.get("length").getAsInt();
106 int startLine = jsonObject.get("startLine").getAsInt();
107 int startColumn = jsonObject.get("startColumn").getAsInt();
108 Integer endLine = jsonObject.get("endLine") == null ? null : jsonObject.get("endLine").getAsInt();
109 Integer endColumn = jsonObject.get("endColumn") == null ? null : jsonObject.get("endColumn").getAsInt();
110 return new Location(file, offset, length, startLine, startColumn, endLine, endColumn);
111 }

◆ fromJsonArray()

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

Definition at line 113 of file Location.java.

113 {
114 if (jsonArray == null) {
115 return EMPTY_LIST;
116 }
117 ArrayList<Location> list = new ArrayList<Location>(jsonArray.size());
118 Iterator<JsonElement> iterator = jsonArray.iterator();
119 while (iterator.hasNext()) {
120 list.add(fromJson(iterator.next().getAsJsonObject()));
121 }
122 return list;
123 }
static Location fromJson(JsonObject jsonObject)
Definition: Location.java:102
static final List< Location > EMPTY_LIST
Definition: Location.java:36

◆ getEndColumn()

Integer org.dartlang.analysis.server.protocol.Location.getEndColumn ( )
inline

The one-based index of the column containing the character immediately following the range.

Definition at line 128 of file Location.java.

128 {
129 return endColumn;
130 }

◆ getEndLine()

Integer org.dartlang.analysis.server.protocol.Location.getEndLine ( )
inline

The one-based index of the line containing the character immediately following the range.

Definition at line 135 of file Location.java.

135 {
136 return endLine;
137 }

◆ getFile()

String org.dartlang.analysis.server.protocol.Location.getFile ( )
inline

The file containing the range.

Definition at line 142 of file Location.java.

142 {
143 return file;
144 }

◆ getLength()

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

The length of the range.

Definition at line 149 of file Location.java.

149 {
150 return length;
151 }

◆ getOffset()

int org.dartlang.analysis.server.protocol.Location.getOffset ( )
inline

The offset of the range.

Definition at line 156 of file Location.java.

156 {
157 return offset;
158 }

◆ getStartColumn()

int org.dartlang.analysis.server.protocol.Location.getStartColumn ( )
inline

The one-based index of the column containing the first character of the range.

Definition at line 163 of file Location.java.

163 {
164 return startColumn;
165 }

◆ getStartLine()

int org.dartlang.analysis.server.protocol.Location.getStartLine ( )
inline

The one-based index of the line containing the first character of the range.

Definition at line 170 of file Location.java.

170 {
171 return startLine;
172 }

◆ hashCode()

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

Definition at line 175 of file Location.java.

175 {
176 HashCodeBuilder builder = new HashCodeBuilder();
177 builder.append(file);
178 builder.append(offset);
179 builder.append(length);
180 builder.append(startLine);
181 builder.append(startColumn);
182 builder.append(endLine);
183 builder.append(endColumn);
184 return builder.toHashCode();
185 }

◆ toJson()

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

Definition at line 187 of file Location.java.

187 {
188 JsonObject jsonObject = new JsonObject();
189 jsonObject.addProperty("file", file);
190 jsonObject.addProperty("offset", offset);
191 jsonObject.addProperty("length", length);
192 jsonObject.addProperty("startLine", startLine);
193 jsonObject.addProperty("startColumn", startColumn);
194 if (endLine != null) {
195 jsonObject.addProperty("endLine", endLine);
196 }
197 if (endColumn != null) {
198 jsonObject.addProperty("endColumn", endColumn);
199 }
200 return jsonObject;
201 }

◆ toString()

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

Definition at line 204 of file Location.java.

204 {
205 StringBuilder builder = new StringBuilder();
206 builder.append("[");
207 builder.append("file=");
208 builder.append(file + ", ");
209 builder.append("offset=");
210 builder.append(offset + ", ");
211 builder.append("length=");
212 builder.append(length + ", ");
213 builder.append("startLine=");
214 builder.append(startLine + ", ");
215 builder.append("startColumn=");
216 builder.append(startColumn + ", ");
217 builder.append("endLine=");
218 builder.append(endLine + ", ");
219 builder.append("endColumn=");
220 builder.append(endColumn);
221 builder.append("]");
222 return builder.toString();
223 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file Location.java.

◆ EMPTY_LIST

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

Definition at line 36 of file Location.java.


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