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

Side by Side Diff: third_party/pkg/angular/lib/core/cache.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 part of angular.core; 1 part of angular.core_internal;
2 2
3 class CacheStats { 3 class CacheStats {
4 final int capacity; 4 final int capacity;
5 final int size; 5 final int size;
6 final int hits; 6 final int hits;
7 final int misses; 7 final int misses;
8 CacheStats(this.capacity, this.size, this.hits, this.misses); 8 CacheStats(this.capacity, this.size, this.hits, this.misses);
9 String toString() => 9 String toString() =>
10 "[CacheStats: capacity: $capacity, size: $size, hits: $hits, misses: $miss es]"; 10 "[CacheStats: capacity: $capacity, size: $size, hits: $hits, misses: $miss es]";
11 } 11 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 /** 70 /**
71 * Simple LRU cache. 71 * Simple LRU cache.
72 * 72 *
73 * TODO(chirayu): 73 * TODO(chirayu):
74 * - add docs 74 * - add docs
75 * - add tests 75 * - add tests
76 * - should stringify keys? 76 * - should stringify keys?
77 */ 77 */
78 class LruCache<K, V> extends Cache<K, V> { 78 class LruCache<K, V> extends Cache<K, V> {
79 Map<K, V> _entries = new LinkedHashMap<K, V>(); 79 final _entries = new LinkedHashMap<K, V>();
80 int _capacity; 80 int _capacity;
81 int _hits = 0; 81 int _hits = 0;
82 int _misses = 0; 82 int _misses = 0;
83 83
84 LruCache({int capacity}) { 84 LruCache({int capacity}) {
85 this._capacity = (capacity == null) ? 0 : capacity; 85 this._capacity = (capacity == null) ? 0 : capacity;
86 } 86 }
87 87
88 V get(K key) { 88 V get(K key) {
89 V value = _entries[key]; 89 V value = _entries[key];
(...skipping 22 matching lines...) Expand all
112 } 112 }
113 113
114 V remove(K key) => _entries.remove(key); 114 V remove(K key) => _entries.remove(key);
115 void removeAll() => _entries.clear(); 115 void removeAll() => _entries.clear();
116 int get capacity => _capacity; 116 int get capacity => _capacity;
117 int get size => _entries.length; 117 int get size => _entries.length;
118 CacheStats stats() => new CacheStats(capacity, size, _hits, _misses); 118 CacheStats stats() => new CacheStats(capacity, size, _hits, _misses);
119 // Debugging helper. 119 // Debugging helper.
120 String toString() => "[$runtimeType: capacity=$capacity, size=$size, items=$_e ntries]"; 120 String toString() => "[$runtimeType: capacity=$capacity, size=$size, items=$_e ntries]";
121 } 121 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/core/annotation_src.dart ('k') | third_party/pkg/angular/lib/core/directive.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698