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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/structure/btree/NodeManager.java

Issue 338503002: Backport B+ tree implementation from Dart to Java. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. 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: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/structure/btree/NodeManager.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/structure/btree/NodeManager.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/structure/btree/NodeManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..a1a497e9fc3723aecb56944fdd2337531f9aaf9d
--- /dev/null
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/index/structure/btree/NodeManager.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, the Dart project authors.
+ *
+ * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.dart.engine.internal.index.structure.btree;
+
+/**
+ * A manager that manages nodes.
+ *
+ * @coverage dart.engine.index.structure
+ */
+public interface NodeManager<K, V, N> {
+ /**
+ * Generates an identifier for a new internal node.
+ */
+ N createInternal();
+
+ /**
+ * Generates an identifier for a new leaf node.
+ */
+ N createLeaf();
+
+ /**
+ * Deletes the node with the given identifier.
+ */
+ void delete(N id);
+
+ /**
+ * The maximum number of keys in an internal node.
+ */
+ int getMaxInternalKeys();
+
+ /**
+ * The maximum number of keys in a leaf node.
+ */
+ int getMaxLeafKeys();
+
+ /**
+ * Checks if the node with the given identifier is an internal or a leaf node.
+ */
+ boolean isInternal(N id);
+
+ /**
+ * Reads information about the internal node with the given identifier.
+ */
+ InternalNodeData<K, N> readInternal(N id);
+
+ /**
+ * Reads information about the leaf node with the given identifier.
+ */
+ LeafNodeData<K, V> readLeaf(N id);
+
+ /**
+ * Writes information about the internal node with the given identifier.
+ */
+ void writeInternal(N id, InternalNodeData<K, N> data);
+
+ /**
+ * Writes information about the leaf node with the given identifier.
+ */
+ void writeLeaf(N id, LeafNodeData<K, V> data);
+}

Powered by Google App Engine
This is Rietveld 408576698