Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
org.dartlang.analysis.server.protocol.Occurrences Class Reference

Public Member Functions

 Occurrences (Element element, int[] offsets, int length)
 
boolean containsInclusive (int x)
 
boolean equals (Object obj)
 
Element getElement ()
 
int getLength ()
 
int[] getOffsets ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static Occurrences fromJson (JsonObject jsonObject)
 
static List< OccurrencesfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final Occurrences[] EMPTY_ARRAY = new Occurrences[0]
 
static final List< OccurrencesEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A description of the references to a single element within a single file.

@coverage dart.server.generated.types

Definition at line 32 of file Occurrences.java.

Constructor & Destructor Documentation

◆ Occurrences()

org.dartlang.analysis.server.protocol.Occurrences.Occurrences ( Element  element,
int[]  offsets,
int  length 
)
inline

Constructor for Occurrences.

Definition at line 56 of file Occurrences.java.

56 {
57 this.element = element;
58 this.offsets = offsets;
59 this.length = length;
60 }

Member Function Documentation

◆ containsInclusive()

boolean org.dartlang.analysis.server.protocol.Occurrences.containsInclusive ( int  x)
inline

Definition at line 62 of file Occurrences.java.

62 {
63 for (int offset : offsets) {
64 if (offset <= x && x <= offset + length) {
65 return true;
66 }
67 }
68 return false;
69 }
double x
Point offset

◆ equals()

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

Definition at line 72 of file Occurrences.java.

72 {
73 if (obj instanceof Occurrences) {
74 Occurrences other = (Occurrences) obj;
75 return
76 ObjectUtilities.equals(other.element, element) &&
77 Arrays.equals(other.offsets, offsets) &&
78 other.length == length;
79 }
80 return false;
81 }

◆ fromJson()

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

Definition at line 83 of file Occurrences.java.

83 {
84 Element element = Element.fromJson(jsonObject.get("element").getAsJsonObject());
85 int[] offsets = JsonUtilities.decodeIntArray(jsonObject.get("offsets").getAsJsonArray());
86 int length = jsonObject.get("length").getAsInt();
87 return new Occurrences(element, offsets, length);
88 }
Occurrences(Element element, int[] offsets, int length)

◆ fromJsonArray()

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

Definition at line 90 of file Occurrences.java.

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

◆ getElement()

Element org.dartlang.analysis.server.protocol.Occurrences.getElement ( )
inline

The element that was referenced.

Definition at line 105 of file Occurrences.java.

105 {
106 return element;
107 }

◆ getLength()

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

The length of the name of the referenced element.

Definition at line 112 of file Occurrences.java.

112 {
113 return length;
114 }

◆ getOffsets()

int[] org.dartlang.analysis.server.protocol.Occurrences.getOffsets ( )
inline

The offsets of the name of the referenced element within the file.

Definition at line 119 of file Occurrences.java.

119 {
120 return offsets;
121 }

◆ hashCode()

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

Definition at line 124 of file Occurrences.java.

124 {
125 HashCodeBuilder builder = new HashCodeBuilder();
126 builder.append(element);
127 builder.append(offsets);
128 builder.append(length);
129 return builder.toHashCode();
130 }

◆ toJson()

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

Definition at line 132 of file Occurrences.java.

132 {
133 JsonObject jsonObject = new JsonObject();
134 jsonObject.add("element", element.toJson());
135 JsonArray jsonArrayOffsets = new JsonArray();
136 for (int elt : offsets) {
137 jsonArrayOffsets.add(new JsonPrimitive(elt));
138 }
139 jsonObject.add("offsets", jsonArrayOffsets);
140 jsonObject.addProperty("length", length);
141 return jsonObject;
142 }

◆ toString()

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

Definition at line 145 of file Occurrences.java.

145 {
146 StringBuilder builder = new StringBuilder();
147 builder.append("[");
148 builder.append("element=");
149 builder.append(element + ", ");
150 builder.append("offsets=");
151 builder.append(StringUtils.join(offsets, ", ") + ", ");
152 builder.append("length=");
153 builder.append(length);
154 builder.append("]");
155 return builder.toString();
156 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file Occurrences.java.

◆ EMPTY_LIST

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

Definition at line 36 of file Occurrences.java.


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