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

Public Member Functions

 Position (String file, int offset)
 
boolean equals (Object obj)
 
String getFile ()
 
int getOffset ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static Position fromJson (JsonObject jsonObject)
 
static List< PositionfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final Position[] EMPTY_ARRAY = new Position[0]
 
static final List< PositionEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A position within a file.

@coverage dart.server.generated.types

Definition at line 32 of file Position.java.

Constructor & Destructor Documentation

◆ Position()

org.dartlang.analysis.server.protocol.Position.Position ( String  file,
int  offset 
)
inline

Constructor for Position.

Definition at line 51 of file Position.java.

51 {
52 this.file = file;
53 this.offset = offset;
54 }

Member Function Documentation

◆ equals()

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

Definition at line 57 of file Position.java.

57 {
58 if (obj instanceof Position) {
59 Position other = (Position) obj;
60 return
61 ObjectUtilities.equals(other.file, file) &&
62 other.offset == offset;
63 }
64 return false;
65 }

◆ fromJson()

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

Definition at line 67 of file Position.java.

67 {
68 String file = jsonObject.get("file").getAsString();
69 int offset = jsonObject.get("offset").getAsInt();
70 return new Position(file, offset);
71 }

◆ fromJsonArray()

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

Definition at line 73 of file Position.java.

73 {
74 if (jsonArray == null) {
75 return EMPTY_LIST;
76 }
77 ArrayList<Position> list = new ArrayList<Position>(jsonArray.size());
78 Iterator<JsonElement> iterator = jsonArray.iterator();
79 while (iterator.hasNext()) {
80 list.add(fromJson(iterator.next().getAsJsonObject()));
81 }
82 return list;
83 }
static final List< Position > EMPTY_LIST
Definition: Position.java:36
static Position fromJson(JsonObject jsonObject)
Definition: Position.java:67

◆ getFile()

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

The file containing the position.

Definition at line 88 of file Position.java.

88 {
89 return file;
90 }

◆ getOffset()

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

The offset of the position.

Definition at line 95 of file Position.java.

95 {
96 return offset;
97 }

◆ hashCode()

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

Definition at line 100 of file Position.java.

100 {
101 HashCodeBuilder builder = new HashCodeBuilder();
102 builder.append(file);
103 builder.append(offset);
104 return builder.toHashCode();
105 }

◆ toJson()

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

Definition at line 107 of file Position.java.

107 {
108 JsonObject jsonObject = new JsonObject();
109 jsonObject.addProperty("file", file);
110 jsonObject.addProperty("offset", offset);
111 return jsonObject;
112 }

◆ toString()

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

Definition at line 115 of file Position.java.

115 {
116 StringBuilder builder = new StringBuilder();
117 builder.append("[");
118 builder.append("file=");
119 builder.append(file + ", ");
120 builder.append("offset=");
121 builder.append(offset);
122 builder.append("]");
123 return builder.toString();
124 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file Position.java.

◆ EMPTY_LIST

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

Definition at line 36 of file Position.java.


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