Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: pkg/analysis_server/lib/plugin/index/index_core.dart

Issue 1409353002: Clean up wording of client usage expectations (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis_server.plugin.index.index_core; 5 library analysis_server.plugin.index.index_core;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/services/index/index.dart'; 10 import 'package:analysis_server/src/services/index/index.dart';
(...skipping 12 matching lines...) Expand all
23 23
24 /** 24 /**
25 * An object that can have a [Relationship] with various [Location]s in a code 25 * An object that can have a [Relationship] with various [Location]s in a code
26 * base. The object is abstractly represented by a [kind] and an [offset] within 26 * base. The object is abstractly represented by a [kind] and an [offset] within
27 * a [source]. 27 * a [source].
28 * 28 *
29 * Clients must ensure that two distinct objects in the same source cannot have 29 * Clients must ensure that two distinct objects in the same source cannot have
30 * the same kind and offset. Failure to do so will make it impossible for 30 * the same kind and offset. Failure to do so will make it impossible for
31 * clients to identify the model element corresponding to the indexable object. 31 * clients to identify the model element corresponding to the indexable object.
32 * 32 *
33 * Clients are expected to subtype this class when implementing plugins. 33 * Clients may implement this class when implementing plugins.
34 */ 34 */
35 abstract class IndexableObject { 35 abstract class IndexableObject {
36 /** 36 /**
37 * Return the absolute path of the file containing the indexable object. 37 * Return the absolute path of the file containing the indexable object.
38 */ 38 */
39 String get filePath; 39 String get filePath;
40 40
41 /** 41 /**
42 * Return the kind of this object. 42 * Return the kind of this object.
43 */ 43 */
44 IndexableObjectKind get kind; 44 IndexableObjectKind get kind;
45 45
46 /** 46 /**
47 * Return the offset of the indexable object within its source. 47 * Return the offset of the indexable object within its source.
48 */ 48 */
49 int get offset; 49 int get offset;
50 } 50 }
51 51
52 /** 52 /**
53 * The kind associated with an [IndexableObject]. 53 * The kind associated with an [IndexableObject].
54 * 54 *
55 * Clients are expected to implement this class when implementing plugins. 55 * Clients may implement this class when implementing plugins.
56 */ 56 */
57 abstract class IndexableObjectKind { 57 abstract class IndexableObjectKind {
58 /** 58 /**
59 * The next available index for a newly created kind of indexable object. 59 * The next available index for a newly created kind of indexable object.
60 */ 60 */
61 static int _nextIndex = 0; 61 static int _nextIndex = 0;
62 62
63 /** 63 /**
64 * A table mapping indexes to object kinds. 64 * A table mapping indexes to object kinds.
65 */ 65 */
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (_registry.containsKey(index)) { 124 if (_registry.containsKey(index)) {
125 throw new ArgumentError('duplicate index for kind: $index'); 125 throw new ArgumentError('duplicate index for kind: $index');
126 } 126 }
127 _registry[index] = kind; 127 _registry[index] = kind;
128 } 128 }
129 } 129 }
130 130
131 /** 131 /**
132 * An object used to add relationships to the index. 132 * An object used to add relationships to the index.
133 * 133 *
134 * Clients are expected to subtype this class when implementing plugins. 134 * Clients may implement this class when implementing plugins.
135 */ 135 */
136 abstract class IndexContributor { 136 abstract class IndexContributor {
137 /** 137 /**
138 * Contribute relationships existing in the given [object] to the given 138 * Contribute relationships existing in the given [object] to the given
139 * index [store] in the given [context]. 139 * index [store] in the given [context].
140 */ 140 */
141 void contributeTo(IndexStore store, AnalysisContext context, Object object); 141 void contributeTo(IndexStore store, AnalysisContext context, Object object);
142 } 142 }
143 143
144 /** 144 /**
145 * An object that stores information about the relationships between locations 145 * An object that stores information about the relationships between locations
146 * in a code base. 146 * in a code base.
147 * 147 *
148 * Clients are not expected to subtype this class. 148 * Clients may not extend, implement or mix-in this class.
149 */ 149 */
150 abstract class IndexStore { 150 abstract class IndexStore {
151 /** 151 /**
152 * Remove all of the information from the index. 152 * Remove all of the information from the index.
153 */ 153 */
154 void clear(); 154 void clear();
155 155
156 /** 156 /**
157 * Return a future that completes with the locations that have the given 157 * Return a future that completes with the locations that have the given
158 * [relationship] with the given [indexable] object. 158 * [relationship] with the given [indexable] object.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 /** 223 /**
224 * Instances of the class [Location] represent a location related to an 224 * Instances of the class [Location] represent a location related to an
225 * indexable object. 225 * indexable object.
226 * 226 *
227 * The location is expressed as an offset and length, but the offset is relative 227 * The location is expressed as an offset and length, but the offset is relative
228 * to the source containing the indexable object rather than the start of the 228 * to the source containing the indexable object rather than the start of the
229 * indexable object within that source. 229 * indexable object within that source.
230 * 230 *
231 * Clients are not expected to subtype this class. 231 * Clients may not extend, implement or mix-in this class.
232 */ 232 */
233 abstract class Location { 233 abstract class Location {
234 /** 234 /**
235 * An empty list of locations. 235 * An empty list of locations.
236 */ 236 */
237 static const List<Location> EMPTY_LIST = const <Location>[]; 237 static const List<Location> EMPTY_LIST = const <Location>[];
238 238
239 /** 239 /**
240 * Return the indexable object containing this location. 240 * Return the indexable object containing this location.
241 */ 241 */
(...skipping 18 matching lines...) Expand all
260 * Return the offset of this location within the source containing the 260 * Return the offset of this location within the source containing the
261 * indexable object. 261 * indexable object.
262 */ 262 */
263 int get offset; 263 int get offset;
264 } 264 }
265 265
266 /** 266 /**
267 * A relationship between an indexable object and a location. Relationships are 267 * A relationship between an indexable object and a location. Relationships are
268 * identified by a globally unique identifier. 268 * identified by a globally unique identifier.
269 * 269 *
270 * Clients are not expected to subtype this class. 270 * Clients may not extend, implement or mix-in this class.
271 */ 271 */
272 abstract class Relationship { 272 abstract class Relationship {
273 /** 273 /**
274 * Return a relationship that has the given [identifier]. If the relationship 274 * Return a relationship that has the given [identifier]. If the relationship
275 * has already been created, then it will be returned, otherwise a new 275 * has already been created, then it will be returned, otherwise a new
276 * relationship will be created 276 * relationship will be created
277 */ 277 */
278 factory Relationship(String identifier) => 278 factory Relationship(String identifier) =>
279 RelationshipImpl.getRelationship(identifier); 279 RelationshipImpl.getRelationship(identifier);
280 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698