OLD | NEW |
---|---|
1 dart_library.library('collection/src/priority_queue', null, /* Imports */[ | 1 dart_library.library('collection/src/priority_queue', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core', | 3 'dart/core', |
4 'dart/collection' | 4 'dart/collection' |
5 ], /* Lazy imports */[ | 5 ], /* Lazy imports */[ |
6 ], function(exports, dart, core, collection) { | 6 ], function(exports, dart, core, collection) { |
7 'use strict'; | 7 'use strict'; |
8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
9 const PriorityQueue$ = dart.generic(function(E) { | 9 const PriorityQueue$ = dart.generic(function(E) { |
10 class PriorityQueue extends core.Object { | 10 class PriorityQueue extends core.Object { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 let last = this[_removeLast](); | 93 let last = this[_removeLast](); |
94 if (dart.notNull(this[_length]) > 0) { | 94 if (dart.notNull(this[_length]) > 0) { |
95 this[_bubbleDown](last, 0); | 95 this[_bubbleDown](last, 0); |
96 } | 96 } |
97 return result; | 97 return result; |
98 } | 98 } |
99 toList() { | 99 toList() { |
100 let list = core.List$(E).new(); | 100 let list = core.List$(E).new(); |
101 list[dartx.length] = this[_length]; | 101 list[dartx.length] = this[_length]; |
102 list[dartx.setRange](0, this[_length], this[_queue]); | 102 list[dartx.setRange](0, this[_length], this[_queue]); |
103 list[dartx.sort](dart.as(this.comparison, __CastType0)); | 103 list[dartx.sort](dart.as(this.comparison, dart.functionType(core.int, [E , E]))); |
Jennifer Messerly
2016/03/12 00:36:56
looks like a bug fix. We weren't instantiating the
| |
104 return list; | 104 return list; |
105 } | 105 } |
106 toSet() { | 106 toSet() { |
107 let set = new (collection.SplayTreeSet$(E))(dart.as(this.comparison, dar t.functionType(core.int, [E, E]))); | 107 let set = new (collection.SplayTreeSet$(E))(dart.as(this.comparison, dar t.functionType(core.int, [E, E]))); |
108 for (let i = 0; i < dart.notNull(this[_length]); i++) { | 108 for (let i = 0; i < dart.notNull(this[_length]); i++) { |
109 set.add(this[_queue][dartx.get](i)); | 109 set.add(this[_queue][dartx.get](i)); |
110 } | 110 } |
111 return set; | 111 return set; |
112 } | 112 } |
113 toString() { | 113 toString() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 [_removeLast]: [E, []], | 228 [_removeLast]: [E, []], |
229 [_bubbleUp]: [dart.void, [E, core.int]], | 229 [_bubbleUp]: [dart.void, [E, core.int]], |
230 [_bubbleDown]: [dart.void, [E, core.int]], | 230 [_bubbleDown]: [dart.void, [E, core.int]], |
231 [_grow]: [dart.void, []] | 231 [_grow]: [dart.void, []] |
232 }) | 232 }) |
233 }); | 233 }); |
234 HeapPriorityQueue._INITIAL_CAPACITY = 7; | 234 HeapPriorityQueue._INITIAL_CAPACITY = 7; |
235 return HeapPriorityQueue; | 235 return HeapPriorityQueue; |
236 }); | 236 }); |
237 let HeapPriorityQueue = HeapPriorityQueue$(); | 237 let HeapPriorityQueue = HeapPriorityQueue$(); |
238 const __CastType0$ = dart.generic(function(E) { | |
239 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core .int, [E, E])); | |
240 return __CastType0; | |
241 }); | |
242 let __CastType0 = __CastType0$(); | |
243 // Exports: | 238 // Exports: |
244 exports.PriorityQueue$ = PriorityQueue$; | 239 exports.PriorityQueue$ = PriorityQueue$; |
245 exports.PriorityQueue = PriorityQueue; | 240 exports.PriorityQueue = PriorityQueue; |
246 exports.HeapPriorityQueue$ = HeapPriorityQueue$; | 241 exports.HeapPriorityQueue$ = HeapPriorityQueue$; |
247 exports.HeapPriorityQueue = HeapPriorityQueue; | 242 exports.HeapPriorityQueue = HeapPriorityQueue; |
248 }); | 243 }); |
OLD | NEW |