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

Unified Diff: lib/coreimpl/splay_tree.dart

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/coreimpl/queue.dart ('k') | lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/coreimpl/splay_tree.dart
diff --git a/lib/coreimpl/splay_tree.dart b/lib/coreimpl/splay_tree.dart
index d5dcef5758aed76de0a9007664467eeced27c0bd..49a28e5be18da8d86f037156feeaeef70e606b4e 100644
--- a/lib/coreimpl/splay_tree.dart
+++ b/lib/coreimpl/splay_tree.dart
@@ -51,7 +51,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
* "Self-adjusting Binary Search Trees" by Sleator and Tarjan.
*/
void splay_(K key) {
- if (isEmpty()) return;
+ if (isEmpty) return;
// The right child of the dummy node will hold
// the L tree of the algorithm. The left child of the dummy node
@@ -106,7 +106,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
}
V operator [](K key) {
- if (!isEmpty()) {
+ if (!isEmpty) {
splay_(key);
if (_root.key.compareTo(key) == 0) return _root.value;
}
@@ -114,7 +114,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
}
V remove(K key) {
- if (isEmpty()) return null;
+ if (isEmpty) return null;
splay_(key);
if (_root.key.compareTo(key) != 0) return null;
V value = _root.value;
@@ -136,7 +136,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
}
void operator []=(K key, V value) {
- if (isEmpty()) {
+ if (isEmpty) {
_count++;
_root = new SplayTreeNode(key, value);
return;
@@ -170,7 +170,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
return value;
}
- bool isEmpty() {
+ bool get isEmpty {
// assert(!((_root === null) && (_count != 0)));
// assert(!((_count == 0) && (_root !== null)));
return (_root === null);
@@ -186,7 +186,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
} else {
f(current.key, current.value);
while (current.right === null) {
- if (list.isEmpty()) return;
+ if (list.isEmpty) return;
current = list.removeLast();
f(current.key, current.value);
}
@@ -205,7 +205,7 @@ class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
}
bool containsKey(K key) {
- if (!isEmpty()) {
+ if (!isEmpty) {
splay_(key);
if (_root.key.compareTo(key) == 0) return true;
}
« no previous file with comments | « lib/coreimpl/queue.dart ('k') | lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698