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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. 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.
37 void removeAll(Iterable elements) { 38 void removeAll(Iterable elements) {
38 throw new UnsupportedError( 39 throw new UnsupportedError(
39 "Cannot remove element of a non-extendable array"); 40 "Cannot remove element of a non-extendable array");
40 } 41 }
41 42
42 void retainAll(Iterable elements) { 43 void retainAll(Iterable elements) {
43 throw new UnsupportedError( 44 throw new UnsupportedError(
44 "Cannot remove element of a non-extendable array"); 45 "Cannot remove element of a non-extendable array");
45 } 46 }
46 47
47 void removeMatching(bool test(E element)) { 48 void removeMatching(bool test(E element)) {
48 throw new UnsupportedError( 49 throw new UnsupportedError(
49 "Cannot remove element of a non-extendable array"); 50 "Cannot remove element of a non-extendable array");
50 } 51 }
51 52
52 void retainMatching(bool test(E element)) { 53 void retainMatching(bool test(E element)) {
53 throw new UnsupportedError( 54 throw new UnsupportedError(
54 "Cannot remove element of a non-extendable array"); 55 "Cannot remove element of a non-extendable array");
55 } 56 }
56 57
58 // List interface.
57 void setRange(int start, int length, List<E> from, [int startFrom = 0]) { 59 void setRange(int start, int length, List<E> from, [int startFrom = 0]) {
58 if (length < 0) { 60 if (length < 0) {
59 throw new ArgumentError("negative length $length"); 61 throw new ArgumentError("negative length $length");
60 } 62 }
61 if (from is _ObjectArray) { 63 if (from is _ObjectArray) {
62 _copyFromObjectArray(from, startFrom, start, length); 64 _copyFromObjectArray(from, startFrom, start, length);
63 } else { 65 } else {
64 Arrays.copy(from, startFrom, this, start, length); 66 Arrays.copy(from, startFrom, this, start, length);
65 } 67 }
66 } 68 }
(...skipping 10 matching lines...) Expand all
77 79
78 List<E> getRange(int start, int length) { 80 List<E> getRange(int start, int length) {
79 if (length == 0) return []; 81 if (length == 0) return [];
80 Arrays.rangeCheck(this, start, length); 82 Arrays.rangeCheck(this, start, length);
81 List list = new _GrowableObjectArray<E>.withCapacity(length); 83 List list = new _GrowableObjectArray<E>.withCapacity(length);
82 list.length = length; 84 list.length = length;
83 Arrays.copy(this, start, list, 0, length); 85 Arrays.copy(this, start, list, 0, length);
84 return list; 86 return list;
85 } 87 }
86 88
87 // Collection interface. 89 // Iterable interface.
88 90
89 bool contains(E element) { 91 bool contains(E element) {
90 return IterableMixinWorkaround.contains(this, element); 92 return IterableMixinWorkaround.contains(this, element);
91 } 93 }
92 94
93 void forEach(f(E element)) { 95 void forEach(f(E element)) {
94 IterableMixinWorkaround.forEach(this, f); 96 IterableMixinWorkaround.forEach(this, f);
95 } 97 }
96 98
97 String join([String separator]) { 99 String join([String separator]) {
98 return IterableMixinWorkaround.joinList(this, separator); 100 return IterableMixinWorkaround.joinList(this, separator);
99 } 101 }
100 102
103 Iterable map(f(E element)) {
104 return IterableMixinWorkaround.map(this, f);
105 }
106
101 List mappedBy(f(E element)) { 107 List mappedBy(f(E element)) {
102 return IterableMixinWorkaround.mappedByList(this, f); 108 IterableMixinWorkaround.mappedByList(this, f);
103 } 109 }
104 110
105 reduce(initialValue, combine(previousValue, E element)) { 111 reduce(initialValue, combine(previousValue, E element)) {
106 return IterableMixinWorkaround.reduce(this, initialValue, combine); 112 return IterableMixinWorkaround.reduce(this, initialValue, combine);
107 } 113 }
108 114
109 Iterable<E> where(bool f(E element)) { 115 Iterable<E> where(bool f(E element)) {
110 return IterableMixinWorkaround.where(this, f); 116 return IterableMixinWorkaround.where(this, f);
111 } 117 }
112 118
113 List<E> take(int n) { 119 Iterable<E> take(int n) {
114 return IterableMixinWorkaround.takeList(this, n); 120 return IterableMixinWorkaround.takeList(this, n);
115 } 121 }
116 122
117 Iterable<E> takeWhile(bool test(E value)) { 123 Iterable<E> takeWhile(bool test(E value)) {
118 return IterableMixinWorkaround.takeWhile(this, test); 124 return IterableMixinWorkaround.takeWhile(this, test);
119 } 125 }
120 126
121 List<E> skip(int n) { 127 Iterable<E> skip(int n) {
122 return IterableMixinWorkaround.skipList(this, n); 128 return IterableMixinWorkaround.skipList(this, n);
123 } 129 }
124 130
125 Iterable<E> skipWhile(bool test(E value)) { 131 Iterable<E> skipWhile(bool test(E value)) {
126 return IterableMixinWorkaround.skipWhile(this, test); 132 return IterableMixinWorkaround.skipWhile(this, test);
127 } 133 }
128 134
129 bool every(bool f(E element)) { 135 bool every(bool f(E element)) {
130 return IterableMixinWorkaround.every(this, f); 136 return IterableMixinWorkaround.every(this, f);
131 } 137 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Collection interface. 323 // Collection interface.
318 324
319 bool contains(E element) { 325 bool contains(E element) {
320 return IterableMixinWorkaround.contains(this, element); 326 return IterableMixinWorkaround.contains(this, element);
321 } 327 }
322 328
323 void forEach(f(E element)) { 329 void forEach(f(E element)) {
324 IterableMixinWorkaround.forEach(this, f); 330 IterableMixinWorkaround.forEach(this, f);
325 } 331 }
326 332
333 Iterable map(f(E element)) {
334 return IterableMixinWorkaround.map(this, f);
335 }
336
327 List mappedBy(f(E element)) { 337 List mappedBy(f(E element)) {
328 return IterableMixinWorkaround.mappedByList(this, f); 338 return IterableMixinWorkaround.mappedByList(this, f);
329 } 339 }
330 340
331 String join([String separator]) { 341 String join([String separator]) {
332 return IterableMixinWorkaround.joinList(this, separator); 342 return IterableMixinWorkaround.joinList(this, separator);
333 } 343 }
334 344
335 reduce(initialValue, combine(previousValue, E element)) { 345 reduce(initialValue, combine(previousValue, E element)) {
336 return IterableMixinWorkaround.reduce(this, initialValue, combine); 346 return IterableMixinWorkaround.reduce(this, initialValue, combine);
337 } 347 }
338 348
339 Iterable<E> where(bool f(E element)) { 349 Iterable<E> where(bool f(E element)) {
340 return IterableMixinWorkaround.where(this, f); 350 return IterableMixinWorkaround.where(this, f);
341 } 351 }
342 352
343 List<E> take(int n) { 353 Iterable<E> take(int n) {
344 return IterableMixinWorkaround.takeList(this, n); 354 return IterableMixinWorkaround.takeList(this, n);
345 } 355 }
346 356
347 Iterable<E> takeWhile(bool test(E value)) { 357 Iterable<E> takeWhile(bool test(E value)) {
348 return IterableMixinWorkaround.takeWhile(this, test); 358 return IterableMixinWorkaround.takeWhile(this, test);
349 } 359 }
350 360
351 List<E> skip(int n) { 361 Iterable<E> skip(int n) {
352 return IterableMixinWorkaround.skipList(this, n); 362 return IterableMixinWorkaround.skipList(this, n);
353 } 363 }
354 364
355 Iterable<E> skipWhile(bool test(E value)) { 365 Iterable<E> skipWhile(bool test(E value)) {
356 return IterableMixinWorkaround.skipWhile(this, test); 366 return IterableMixinWorkaround.skipWhile(this, test);
357 } 367 }
358 368
359 bool every(bool f(E element)) { 369 bool every(bool f(E element)) {
360 return IterableMixinWorkaround.every(this, f); 370 return IterableMixinWorkaround.every(this, f);
361 } 371 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 498 }
489 _position = _length; 499 _position = _length;
490 _current = null; 500 _current = null;
491 return false; 501 return false;
492 } 502 }
493 503
494 E get current { 504 E get current {
495 return _current; 505 return _current;
496 } 506 }
497 } 507 }
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