| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 services.index; | 5 library services.index; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/index/index_core.dart'; | 9 import 'package:analysis_server/plugin/index/index_core.dart'; |
| 10 import 'package:analysis_server/src/services/index/indexable_element.dart'; | 10 import 'package:analysis_server/src/services/index/indexable_element.dart'; |
| 11 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/src/generated/element.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | |
| 14 | 13 |
| 15 /** | 14 /** |
| 16 * A filter for [Element] names. | 15 * A filter for [Element] names. |
| 17 */ | 16 */ |
| 18 typedef bool ElementNameFilter(String name); | 17 typedef bool ElementNameFilter(String name); |
| 19 | 18 |
| 20 /** | 19 /** |
| 21 * The interface [Index] defines the behavior of objects that maintain an index | 20 * The interface [Index] defines the behavior of objects that maintain an index |
| 22 * storing relations between indexable objects. | 21 * storing relations between indexable objects. |
| 23 * | 22 * |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 * The name to be indexed. | 71 * The name to be indexed. |
| 73 */ | 72 */ |
| 74 final String name; | 73 final String name; |
| 75 | 74 |
| 76 /** | 75 /** |
| 77 * Initialize a newly created indexable name to represent the given [name]. | 76 * Initialize a newly created indexable name to represent the given [name]. |
| 78 */ | 77 */ |
| 79 IndexableName(this.name); | 78 IndexableName(this.name); |
| 80 | 79 |
| 81 @override | 80 @override |
| 81 String get filePath => null; |
| 82 |
| 83 @override |
| 82 IndexableObjectKind get kind => IndexableNameKind.INSTANCE; | 84 IndexableObjectKind get kind => IndexableNameKind.INSTANCE; |
| 83 | 85 |
| 84 @override | 86 @override |
| 85 int get offset { | 87 int get offset { |
| 86 return -1; | 88 return -1; |
| 87 } | 89 } |
| 88 | 90 |
| 89 @override | 91 @override |
| 90 Source get source => null; | |
| 91 | |
| 92 @override | |
| 93 bool operator ==(Object object) => | 92 bool operator ==(Object object) => |
| 94 object is IndexableName && object.name == name; | 93 object is IndexableName && object.name == name; |
| 95 | 94 |
| 96 @override | 95 @override |
| 97 String toString() => name; | 96 String toString() => name; |
| 98 } | 97 } |
| 99 | 98 |
| 100 /** | 99 /** |
| 101 * The kind of an indexable name. | 100 * The kind of an indexable name. |
| 102 */ | 101 */ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 * A table mapping relationship identifiers to relationships. | 330 * A table mapping relationship identifiers to relationships. |
| 332 */ | 331 */ |
| 333 static Map<String, RelationshipImpl> _RELATIONSHIP_MAP = {}; | 332 static Map<String, RelationshipImpl> _RELATIONSHIP_MAP = {}; |
| 334 | 333 |
| 335 /** | 334 /** |
| 336 * The next artificial hash code. | 335 * The next artificial hash code. |
| 337 */ | 336 */ |
| 338 static int _NEXT_HASH_CODE = 0; | 337 static int _NEXT_HASH_CODE = 0; |
| 339 | 338 |
| 340 /** | 339 /** |
| 341 * The artifitial hash code for this object. | 340 * The artificial hash code for this object. |
| 342 */ | 341 */ |
| 343 final int _hashCode = _NEXT_HASH_CODE++; | 342 final int _hashCode = _NEXT_HASH_CODE++; |
| 344 | 343 |
| 345 /** | 344 /** |
| 346 * The unique identifier for this relationship. | 345 * The unique identifier for this relationship. |
| 347 */ | 346 */ |
| 348 final String identifier; | 347 final String identifier; |
| 349 | 348 |
| 350 /** | 349 /** |
| 351 * Initialize a newly created relationship with the given unique identifier. | 350 * Initialize a newly created relationship with the given unique identifier. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 363 */ | 362 */ |
| 364 static RelationshipImpl getRelationship(String identifier) { | 363 static RelationshipImpl getRelationship(String identifier) { |
| 365 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier]; | 364 RelationshipImpl relationship = _RELATIONSHIP_MAP[identifier]; |
| 366 if (relationship == null) { | 365 if (relationship == null) { |
| 367 relationship = new RelationshipImpl(identifier); | 366 relationship = new RelationshipImpl(identifier); |
| 368 _RELATIONSHIP_MAP[identifier] = relationship; | 367 _RELATIONSHIP_MAP[identifier] = relationship; |
| 369 } | 368 } |
| 370 return relationship; | 369 return relationship; |
| 371 } | 370 } |
| 372 } | 371 } |
| OLD | NEW |