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

Unified Diff: pkg/analysis_server/test/index/store/memory_node_manager.dart

Issue 365193004: Move Index and IndexStore implementations into Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/index/store/memory_node_manager.dart
diff --git a/pkg/analysis_server/test/index/store/memory_node_manager.dart b/pkg/analysis_server/test/index/store/memory_node_manager.dart
deleted file mode 100644
index 3a9209e8d9b9d716d793547eabce3f58bd7344dc..0000000000000000000000000000000000000000
--- a/pkg/analysis_server/test/index/store/memory_node_manager.dart
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.index.store_memory_node_manager;
-
-import 'dart:async';
-import 'dart:collection';
-
-import 'package:analysis_server/src/index/store/codec.dart';
-import 'package:analysis_server/src/index/store/split_store.dart';
-import 'package:analyzer/src/generated/engine.dart';
-
-
-class MemoryNodeManager implements NodeManager {
- ContextCodec _contextCodec = new ContextCodec();
- ElementCodec _elementCodec;
- int _locationCount = 0;
- final Map<String, int> _nodeLocationCounts = new HashMap<String, int>();
- final Map<String, IndexNode> _nodes = new HashMap<String, IndexNode>();
- RelationshipCodec _relationshipCodec;
- StringCodec _stringCodec = new StringCodec();
-
- MemoryNodeManager() {
- _elementCodec = new ElementCodec(_stringCodec);
- _relationshipCodec = new RelationshipCodec(_stringCodec);
- }
-
- @override
- ContextCodec get contextCodec {
- return _contextCodec;
- }
-
- @override
- ElementCodec get elementCodec {
- return _elementCodec;
- }
-
- @override
- int get locationCount {
- return _locationCount;
- }
-
- @override
- StringCodec get stringCodec {
- return _stringCodec;
- }
-
- @override
- void clear() {
- _nodes.clear();
- }
-
- int getLocationCount(String name) {
- int locationCount = _nodeLocationCounts[name];
- return locationCount != null ? locationCount : 0;
- }
-
- @override
- Future<IndexNode> getNode(String name) {
- return new Future.value(_nodes[name]);
- }
-
- bool isEmpty() {
- for (IndexNode node in _nodes.values) {
- Map<RelationKeyData, List<LocationData>> relations = node.relations;
- if (!relations.isEmpty) {
- return false;
- }
- }
- return true;
- }
-
- @override
- IndexNode newNode(AnalysisContext context) {
- return new IndexNode(context, elementCodec, _relationshipCodec);
- }
-
- @override
- void putNode(String name, IndexNode node) {
- // update location count
- {
- _locationCount -= getLocationCount(name);
- int nodeLocationCount = node.locationCount;
- _nodeLocationCounts[name] = nodeLocationCount;
- _locationCount += nodeLocationCount;
- }
- // remember the node
- _nodes[name] = node;
- }
-
- @override
- void removeNode(String name) {
- _nodes.remove(name);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698