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

Side by Side Diff: runtime/lib/array.dart

Issue 12087103: Revert "Rename mappedBy to map." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« no previous file with comments | « pkg/yaml/lib/yaml_map.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 // TODO(srdjan): Use shared array implementation. 6 // TODO(srdjan): Use shared array implementation.
7 class _ObjectArray<E> implements List<E> { 7 class _ObjectArray<E> implements List<E> {
8 8
9 factory _ObjectArray(int length) native "ObjectArray_allocate"; 9 factory _ObjectArray(int length) native "ObjectArray_allocate";
10 10
(...skipping 16 matching lines...) Expand all
27 E removeAt(int index) { 27 E removeAt(int index) {
28 throw new UnsupportedError( 28 throw new UnsupportedError(
29 "Cannot remove element of a non-extendable array"); 29 "Cannot remove element of a non-extendable array");
30 } 30 }
31 31
32 void remove(Object element) { 32 void remove(Object element) {
33 throw new UnsupportedError( 33 throw new UnsupportedError(
34 "Cannot remove element of a non-extendable array"); 34 "Cannot remove element of a non-extendable array");
35 } 35 }
36 36
37 // Collection interface.
38 void removeAll(Iterable elements) { 37 void removeAll(Iterable elements) {
39 throw new UnsupportedError( 38 throw new UnsupportedError(
40 "Cannot remove element of a non-extendable array"); 39 "Cannot remove element of a non-extendable array");
41 } 40 }
42 41
43 void retainAll(Iterable elements) { 42 void retainAll(Iterable elements) {
44 throw new UnsupportedError( 43 throw new UnsupportedError(
45 "Cannot remove element of a non-extendable array"); 44 "Cannot remove element of a non-extendable array");
46 } 45 }
47 46
48 void removeMatching(bool test(E element)) { 47 void removeMatching(bool test(E element)) {
49 throw new UnsupportedError( 48 throw new UnsupportedError(
50 "Cannot remove element of a non-extendable array"); 49 "Cannot remove element of a non-extendable array");
51 } 50 }
52 51
53 void retainMatching(bool test(E element)) { 52 void retainMatching(bool test(E element)) {
54 throw new UnsupportedError( 53 throw new UnsupportedError(
55 "Cannot remove element of a non-extendable array"); 54 "Cannot remove element of a non-extendable array");
56 } 55 }
57 56
58 // List interface.
59 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { 57 void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
60 if (length < 0) { 58 if (length < 0) {
61 throw new ArgumentError("negative length $length"); 59 throw new ArgumentError("negative length $length");
62 } 60 }
63 if (from is _ObjectArray) { 61 if (from is _ObjectArray) {
64 _copyFromObjectArray(from, startFrom, start, length); 62 _copyFromObjectArray(from, startFrom, start, length);
65 } else { 63 } else {
66 Arrays.copy(from, startFrom, this, start, length); 64 Arrays.copy(from, startFrom, this, start, length);
67 } 65 }
68 } 66 }
(...skipping 10 matching lines...) Expand all
79 77
80 List<E> getRange(int start, int length) { 78 List<E> getRange(int start, int length) {
81 if (length == 0) return []; 79 if (length == 0) return [];
82 Arrays.rangeCheck(this, start, length); 80 Arrays.rangeCheck(this, start, length);
83 List list = new _GrowableObjectArray<E>.withCapacity(length); 81 List list = new _GrowableObjectArray<E>.withCapacity(length);
84 list.length = length; 82 list.length = length;
85 Arrays.copy(this, start, list, 0, length); 83 Arrays.copy(this, start, list, 0, length);
86 return list; 84 return list;
87 } 85 }
88 86
89 // Iterable interface. 87 // Collection interface.
90 88
91 bool contains(E element) { 89 bool contains(E element) {
92 return IterableMixinWorkaround.contains(this, element); 90 return IterableMixinWorkaround.contains(this, element);
93 } 91 }
94 92
95 void forEach(f(E element)) { 93 void forEach(f(E element)) {
96 IterableMixinWorkaround.forEach(this, f); 94 IterableMixinWorkaround.forEach(this, f);
97 } 95 }
98 96
99 String join([String separator]) { 97 String join([String separator]) {
100 return IterableMixinWorkaround.joinList(this, separator); 98 return IterableMixinWorkaround.joinList(this, separator);
101 } 99 }
102 100
103 Iterable map(f(E element)) {
104 return IterableMixinWorkaround.map(this, f);
105 }
106
107 List mappedBy(f(E element)) { 101 List mappedBy(f(E element)) {
108 IterableMixinWorkaround.mappedByList(this, f); 102 return IterableMixinWorkaround.mappedByList(this, f);
109 } 103 }
110 104
111 reduce(initialValue, combine(previousValue, E element)) { 105 reduce(initialValue, combine(previousValue, E element)) {
112 return IterableMixinWorkaround.reduce(this, initialValue, combine); 106 return IterableMixinWorkaround.reduce(this, initialValue, combine);
113 } 107 }
114 108
115 Iterable<E> where(bool f(E element)) { 109 Iterable<E> where(bool f(E element)) {
116 return IterableMixinWorkaround.where(this, f); 110 return IterableMixinWorkaround.where(this, f);
117 } 111 }
118 112
119 Iterable<E> take(int n) { 113 List<E> take(int n) {
120 return IterableMixinWorkaround.takeList(this, n); 114 return IterableMixinWorkaround.takeList(this, n);
121 } 115 }
122 116
123 Iterable<E> takeWhile(bool test(E value)) { 117 Iterable<E> takeWhile(bool test(E value)) {
124 return IterableMixinWorkaround.takeWhile(this, test); 118 return IterableMixinWorkaround.takeWhile(this, test);
125 } 119 }
126 120
127 Iterable<E> skip(int n) { 121 List<E> skip(int n) {
128 return IterableMixinWorkaround.skipList(this, n); 122 return IterableMixinWorkaround.skipList(this, n);
129 } 123 }
130 124
131 Iterable<E> skipWhile(bool test(E value)) { 125 Iterable<E> skipWhile(bool test(E value)) {
132 return IterableMixinWorkaround.skipWhile(this, test); 126 return IterableMixinWorkaround.skipWhile(this, test);
133 } 127 }
134 128
135 bool every(bool f(E element)) { 129 bool every(bool f(E element)) {
136 return IterableMixinWorkaround.every(this, f); 130 return IterableMixinWorkaround.every(this, f);
137 } 131 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // Collection interface. 317 // Collection interface.
324 318
325 bool contains(E element) { 319 bool contains(E element) {
326 return IterableMixinWorkaround.contains(this, element); 320 return IterableMixinWorkaround.contains(this, element);
327 } 321 }
328 322
329 void forEach(f(E element)) { 323 void forEach(f(E element)) {
330 IterableMixinWorkaround.forEach(this, f); 324 IterableMixinWorkaround.forEach(this, f);
331 } 325 }
332 326
333 Iterable map(f(E element)) {
334 return IterableMixinWorkaround.map(this, f);
335 }
336
337 List mappedBy(f(E element)) { 327 List mappedBy(f(E element)) {
338 return IterableMixinWorkaround.mappedByList(this, f); 328 return IterableMixinWorkaround.mappedByList(this, f);
339 } 329 }
340 330
341 String join([String separator]) { 331 String join([String separator]) {
342 return IterableMixinWorkaround.joinList(this, separator); 332 return IterableMixinWorkaround.joinList(this, separator);
343 } 333 }
344 334
345 reduce(initialValue, combine(previousValue, E element)) { 335 reduce(initialValue, combine(previousValue, E element)) {
346 return IterableMixinWorkaround.reduce(this, initialValue, combine); 336 return IterableMixinWorkaround.reduce(this, initialValue, combine);
347 } 337 }
348 338
349 Iterable<E> where(bool f(E element)) { 339 Iterable<E> where(bool f(E element)) {
350 return IterableMixinWorkaround.where(this, f); 340 return IterableMixinWorkaround.where(this, f);
351 } 341 }
352 342
353 Iterable<E> take(int n) { 343 List<E> take(int n) {
354 return IterableMixinWorkaround.takeList(this, n); 344 return IterableMixinWorkaround.takeList(this, n);
355 } 345 }
356 346
357 Iterable<E> takeWhile(bool test(E value)) { 347 Iterable<E> takeWhile(bool test(E value)) {
358 return IterableMixinWorkaround.takeWhile(this, test); 348 return IterableMixinWorkaround.takeWhile(this, test);
359 } 349 }
360 350
361 Iterable<E> skip(int n) { 351 List<E> skip(int n) {
362 return IterableMixinWorkaround.skipList(this, n); 352 return IterableMixinWorkaround.skipList(this, n);
363 } 353 }
364 354
365 Iterable<E> skipWhile(bool test(E value)) { 355 Iterable<E> skipWhile(bool test(E value)) {
366 return IterableMixinWorkaround.skipWhile(this, test); 356 return IterableMixinWorkaround.skipWhile(this, test);
367 } 357 }
368 358
369 bool every(bool f(E element)) { 359 bool every(bool f(E element)) {
370 return IterableMixinWorkaround.every(this, f); 360 return IterableMixinWorkaround.every(this, f);
371 } 361 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 488 }
499 _position = _length; 489 _position = _length;
500 _current = null; 490 _current = null;
501 return false; 491 return false;
502 } 492 }
503 493
504 E get current { 494 E get current {
505 return _current; 495 return _current;
506 } 496 }
507 } 497 }
OLDNEW
« no previous file with comments | « pkg/yaml/lib/yaml_map.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698