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

Public Member Functions

 NavigationRegion (int offset, int length, int[] targets)
 
boolean containsInclusive (int x)
 
boolean equals (Object obj)
 
List< NavigationTargetgetTargetObjects ()
 
int getLength ()
 
int getOffset ()
 
int[] getTargets ()
 
int hashCode ()
 
void lookupTargets (List< NavigationTarget > allTargets)
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static NavigationRegion fromJson (JsonObject jsonObject)
 
static List< NavigationRegionfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final NavigationRegion[] EMPTY_ARRAY = new NavigationRegion[0]
 
static final List< NavigationRegionEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A description of a region from which the user can navigate to the declaration of an element.

@coverage dart.server.generated.types

Definition at line 32 of file NavigationRegion.java.

Constructor & Destructor Documentation

◆ NavigationRegion()

org.dartlang.analysis.server.protocol.NavigationRegion.NavigationRegion ( int  offset,
int  length,
int[]  targets 
)
inline

Constructor for NavigationRegion.

Definition at line 60 of file NavigationRegion.java.

60 {
61 this.offset = offset;
62 this.length = length;
63 this.targets = targets;
64 }

Member Function Documentation

◆ containsInclusive()

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

Definition at line 66 of file NavigationRegion.java.

66 {
67 return offset <= x && x <= offset + length;
68 }
double x

◆ equals()

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

Definition at line 71 of file NavigationRegion.java.

71 {
72 if (obj instanceof NavigationRegion) {
74 return
75 other.offset == offset &&
76 other.length == length &&
77 Arrays.equals(other.targets, targets);
78 }
79 return false;
80 }
NavigationRegion(int offset, int length, int[] targets)

◆ fromJson()

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

Definition at line 82 of file NavigationRegion.java.

82 {
83 int offset = jsonObject.get("offset").getAsInt();
84 int length = jsonObject.get("length").getAsInt();
85 int[] targets = JsonUtilities.decodeIntArray(jsonObject.get("targets").getAsJsonArray());
86 return new NavigationRegion(offset, length, targets);
87 }

◆ fromJsonArray()

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

Definition at line 89 of file NavigationRegion.java.

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

◆ getLength()

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

The length of the region from which the user can navigate.

Definition at line 108 of file NavigationRegion.java.

108 {
109 return length;
110 }

◆ getOffset()

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

The offset of the region from which the user can navigate.

Definition at line 115 of file NavigationRegion.java.

115 {
116 return offset;
117 }

◆ getTargetObjects()

List< NavigationTarget > org.dartlang.analysis.server.protocol.NavigationRegion.getTargetObjects ( )
inline

Definition at line 101 of file NavigationRegion.java.

101 {
102 return targetObjects;
103 }

◆ getTargets()

int[] org.dartlang.analysis.server.protocol.NavigationRegion.getTargets ( )
inline

The indexes of the targets (in the enclosing navigation response) to which the given region is bound. By opening the target, clients can implement one form of navigation. This list cannot be empty.

Definition at line 124 of file NavigationRegion.java.

124 {
125 return targets;
126 }

◆ hashCode()

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

Definition at line 129 of file NavigationRegion.java.

129 {
130 HashCodeBuilder builder = new HashCodeBuilder();
131 builder.append(offset);
132 builder.append(length);
133 builder.append(targets);
134 return builder.toHashCode();
135 }

◆ lookupTargets()

void org.dartlang.analysis.server.protocol.NavigationRegion.lookupTargets ( List< NavigationTarget allTargets)
inline

Definition at line 137 of file NavigationRegion.java.

137 {
138 for (int i = 0; i < targets.length; i++) {
139 int targetIndex = targets[i];
140 NavigationTarget target = allTargets.get(targetIndex);
141 targetObjects.add(target);
142 }
143 }
uint32_t * target

◆ toJson()

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

Definition at line 145 of file NavigationRegion.java.

145 {
146 JsonObject jsonObject = new JsonObject();
147 jsonObject.addProperty("offset", offset);
148 jsonObject.addProperty("length", length);
149 JsonArray jsonArrayTargets = new JsonArray();
150 for (int elt : targets) {
151 jsonArrayTargets.add(new JsonPrimitive(elt));
152 }
153 jsonObject.add("targets", jsonArrayTargets);
154 return jsonObject;
155 }

◆ toString()

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

Definition at line 158 of file NavigationRegion.java.

158 {
159 StringBuilder builder = new StringBuilder();
160 builder.append("[");
161 builder.append("offset=");
162 builder.append(offset + ", ");
163 builder.append("length=");
164 builder.append(length + ", ");
165 builder.append("targets=");
166 builder.append(StringUtils.join(targets, ", "));
167 builder.append("]");
168 return builder.toString();
169 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file NavigationRegion.java.

◆ EMPTY_LIST

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

Definition at line 36 of file NavigationRegion.java.


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