OLD | NEW |
1 part of dart.collection; | 1 part of dart.collection; |
2 abstract class Queue<E> implements Iterable<E>, EfficientLength {factory Queue(
) = ListQueue<E>; | 2 abstract class Queue<E> implements Iterable<E>, EfficientLength {factory Queue(
) = ListQueue<E>; |
3 factory Queue.from(Iterable elements) = ListQueue<E>.from; | 3 factory Queue.from(Iterable elements) = ListQueue<E>.from; |
4 E removeFirst(); | 4 E removeFirst(); |
5 E removeLast(); | 5 E removeLast(); |
6 void addFirst(E value); | 6 void addFirst(E value); |
7 void addLast(E value); | 7 void addLast(E value); |
8 void add(E value); | 8 void add(E value); |
9 bool remove(Object object); | 9 bool remove(Object object); |
10 void addAll(Iterable<E> iterable); | 10 void addAll(Iterable<E> iterable); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 int _elementCount = 0; | 70 int _elementCount = 0; |
71 DoubleLinkedQueue() { | 71 DoubleLinkedQueue() { |
72 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>(); | 72 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>(); |
73 } | 73 } |
74 factory DoubleLinkedQueue.from(Iterable elements) { | 74 factory DoubleLinkedQueue.from(Iterable elements) { |
75 Queue<E> list = ((__x17) => DEVC$RT.cast(__x17, DEVC$RT.type((DoubleLinkedQueue<
dynamic> _) { | 75 Queue<E> list = ((__x17) => DEVC$RT.cast(__x17, DEVC$RT.type((DoubleLinkedQueue<
dynamic> _) { |
76 } | 76 } |
77 ), DEVC$RT.type((Queue<E> _) { | 77 ), DEVC$RT.type((Queue<E> _) { |
78 } | 78 } |
79 ), "InferableAllocation", """line 207, column 21 of dart:collection/queue.dart:
""", __x17 is Queue<E>, false))(new DoubleLinkedQueue()); | 79 ), "InferableAllocation", """line 207, column 21 of dart:collection/queue.dart:
""", __x17 is Queue<E>, false))(new DoubleLinkedQueue()); |
80 for (final E e in elements) { | 80 for (final E e in DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic> _) { |
| 81 } |
| 82 ), DEVC$RT.type((Iterable<E> _) { |
| 83 } |
| 84 ), "CompositeCast", """line 208, column 23 of dart:collection/queue.dart: """, e
lements is Iterable<E>, false)) { |
81 list.addLast(e); | 85 list.addLast(e); |
82 } | 86 } |
83 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) { | 87 return DEVC$RT.cast(list, DEVC$RT.type((Queue<E> _) { |
84 } | 88 } |
85 ), DEVC$RT.type((DoubleLinkedQueue<E> _) { | 89 ), DEVC$RT.type((DoubleLinkedQueue<E> _) { |
86 } | 90 } |
87 ), "CompositeCast", """line 211, column 12 of dart:collection/queue.dart: """, l
ist is DoubleLinkedQueue<E>, false); | 91 ), "CompositeCast", """line 211, column 12 of dart:collection/queue.dart: """, l
ist is DoubleLinkedQueue<E>, false); |
88 } | 92 } |
89 int get length => _elementCount; | 93 int get length => _elementCount; |
90 void addLast(E value) { | 94 void addLast(E value) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s
ourceList is Iterable<E>, false), 0); | 233 ), "CompositeCast", """line 402, column 40 of dart:collection/queue.dart: """, s
ourceList is Iterable<E>, false), 0); |
230 queue._tail = length; | 234 queue._tail = length; |
231 return queue; | 235 return queue; |
232 } | 236 } |
233 else { | 237 else { |
234 int capacity = _INITIAL_CAPACITY; | 238 int capacity = _INITIAL_CAPACITY; |
235 if (elements is EfficientLength) { | 239 if (elements is EfficientLength) { |
236 capacity = elements.length; | 240 capacity = elements.length; |
237 } | 241 } |
238 ListQueue<E> result = new ListQueue<E>(capacity); | 242 ListQueue<E> result = new ListQueue<E>(capacity); |
239 for (final E element in elements) { | 243 for (final E element in DEVC$RT.cast(elements, DEVC$RT.type((Iterable<dynamic>
_) { |
| 244 } |
| 245 ), DEVC$RT.type((Iterable<E> _) { |
| 246 } |
| 247 ), "CompositeCast", """line 411, column 31 of dart:collection/queue.dart: """, e
lements is Iterable<E>, false)) { |
240 result.addLast(element); | 248 result.addLast(element); |
241 } | 249 } |
242 return result; | 250 return result; |
243 } | 251 } |
244 } | 252 } |
245 Iterator<E> get iterator => new _ListQueueIterator<E>(this); | 253 Iterator<E> get iterator => new _ListQueueIterator<E>(this); |
246 void forEach(void action(E element)) { | 254 void forEach(void action(E element)) { |
247 int modificationCount = _modificationCount; | 255 int modificationCount = _modificationCount; |
248 for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) { | 256 for (int i = _head; i != _tail; i = (i + 1) & (_table.length - 1)) { |
249 action(_table[i]); | 257 action(_table[i]); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 _queue._checkModification(_modificationCount); | 500 _queue._checkModification(_modificationCount); |
493 if (_position == _end) { | 501 if (_position == _end) { |
494 _current = null; | 502 _current = null; |
495 return false; | 503 return false; |
496 } | 504 } |
497 _current = ((__x19) => DEVC$RT.cast(__x19, dynamic, E, "CompositeCast", """line
738, column 16 of dart:collection/queue.dart: """, __x19 is E, false))(_queue._
table[_position]); | 505 _current = ((__x19) => DEVC$RT.cast(__x19, dynamic, E, "CompositeCast", """line
738, column 16 of dart:collection/queue.dart: """, __x19 is E, false))(_queue._
table[_position]); |
498 _position = (_position + 1) & (_queue._table.length - 1); | 506 _position = (_position + 1) & (_queue._table.length - 1); |
499 return true; | 507 return true; |
500 } | 508 } |
501 } | 509 } |
OLD | NEW |