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

Side by Side Diff: client/dom/frog/frog_dom.dart

Issue 8889001: Implement typed array constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comment Created 9 years 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 | « no previous file | client/dom/frog_dom.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 #library('dom'); 1 #library('dom');
2 2
3 #native('frog_dom.js'); 3 #native('frog_dom.js');
4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 4 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
5 // for details. All rights reserved. Use of this source code is governed by a 5 // for details. All rights reserved. Use of this source code is governed by a
6 // BSD-style license that can be found in the LICENSE file. 6 // BSD-style license that can be found in the LICENSE file.
7 7
8 // DO NOT EDIT 8 // DO NOT EDIT
9 // Auto-generated Dart DOM library. 9 // Auto-generated Dart DOM library.
10 10
11 11
12 12
13 // #source('src/_FactoryProviders.dart');
13 14
14 class Window extends DOMWindow {} 15 class Window extends DOMWindow {}
15 DOMWindow get window() native "return window;"; 16 DOMWindow get window() native "return window;";
16 // TODO(vsm): Revert to Dart method when 508 is fixed. 17 // TODO(vsm): Revert to Dart method when 508 is fixed.
17 HTMLDocument get document() native "return window.document;"; 18 HTMLDocument get document() native "return window.document;";
18 19
19 class AbstractWorker native "*AbstractWorker" { 20 class AbstractWorker native "*AbstractWorker" {
20 21
21 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native; 22 void addEventListener(String type, EventListener listener, [bool useCapture = null]) native;
22 23
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 591
591 String get typeName() native; 592 String get typeName() native;
592 } 593 }
593 594
594 class CanvasPixelArray native "*CanvasPixelArray" { 595 class CanvasPixelArray native "*CanvasPixelArray" {
595 596
596 int length; 597 int length;
597 598
598 int operator[](int index) native; 599 int operator[](int index) native;
599 600
601 void operator[]=(int index, int value) native;
602
600 var dartObjectLocalStorage; 603 var dartObjectLocalStorage;
601 604
602 String get typeName() native; 605 String get typeName() native;
603 } 606 }
604 607
605 class CanvasRenderingContext native "*CanvasRenderingContext" { 608 class CanvasRenderingContext native "*CanvasRenderingContext" {
606 609
607 HTMLCanvasElement canvas; 610 HTMLCanvasElement canvas;
608 611
609 var dartObjectLocalStorage; 612 var dartObjectLocalStorage;
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 2314
2312 void truncate(int size) native; 2315 void truncate(int size) native;
2313 2316
2314 void write(Blob data) native; 2317 void write(Blob data) native;
2315 2318
2316 var dartObjectLocalStorage; 2319 var dartObjectLocalStorage;
2317 2320
2318 String get typeName() native; 2321 String get typeName() native;
2319 } 2322 }
2320 2323
2321 class Float32Array extends ArrayBufferView native "*Float32Array" { 2324 class Float32Array extends ArrayBufferView implements List<num> native "Float32A rray" {
2325
2326 factory Float32Array(int length) => _construct(length);
2327
2328 factory Float32Array.fromList(List<num> list) => _construct(list);
2329
2330 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
2331
2332 static _construct(arg) native 'return new Float32Array(arg);';
2322 2333
2323 static final int BYTES_PER_ELEMENT = 4; 2334 static final int BYTES_PER_ELEMENT = 4;
2324 2335
2325 int length; 2336 int length;
2326 2337
2338 num operator[](int index) native;
2339
2340 void operator[]=(int index, num value) native;
2341
2327 Float32Array subarray(int start, [int end = null]) native; 2342 Float32Array subarray(int start, [int end = null]) native;
2328 } 2343 }
2329 2344
2330 class Float64Array extends ArrayBufferView native "*Float64Array" { 2345 class Float64Array extends ArrayBufferView implements List<num> native "Float64A rray" {
2346
2347 factory Float64Array(int length) => _construct(length);
2348
2349 factory Float64Array.fromList(List<num> list) => _construct(list);
2350
2351 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
2352
2353 static _construct(arg) native 'return new Float64Array(arg);';
2331 2354
2332 static final int BYTES_PER_ELEMENT = 8; 2355 static final int BYTES_PER_ELEMENT = 8;
2333 2356
2334 int length; 2357 int length;
2335 2358
2359 num operator[](int index) native;
2360
2361 void operator[]=(int index, num value) native;
2362
2336 Float64Array subarray(int start, [int end = null]) native; 2363 Float64Array subarray(int start, [int end = null]) native;
2337 } 2364 }
2338 2365
2339 class Geolocation native "*Geolocation" { 2366 class Geolocation native "*Geolocation" {
2340 2367
2341 void clearWatch(int watchId) native; 2368 void clearWatch(int watchId) native;
2342 2369
2343 void getCurrentPosition(PositionCallback successCallback, [PositionErrorCallba ck errorCallback = null]) native; 2370 void getCurrentPosition(PositionCallback successCallback, [PositionErrorCallba ck errorCallback = null]) native;
2344 2371
2345 int watchPosition(PositionCallback successCallback, [PositionErrorCallback err orCallback = null]) native; 2372 int watchPosition(PositionCallback successCallback, [PositionErrorCallback err orCallback = null]) native;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 2601
2575 String toDataURL(String type) native; 2602 String toDataURL(String type) native;
2576 } 2603 }
2577 2604
2578 class HTMLCollection native "HTMLCollection" { 2605 class HTMLCollection native "HTMLCollection" {
2579 2606
2580 int length; 2607 int length;
2581 2608
2582 Node operator[](int index) native; 2609 Node operator[](int index) native;
2583 2610
2611 void operator[]=(int index, Node value) {
2612 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
2613 }
2614
2584 Node item(int index) native; 2615 Node item(int index) native;
2585 2616
2586 Node namedItem(String name) native; 2617 Node namedItem(String name) native;
2587 2618
2588 var dartObjectLocalStorage; 2619 var dartObjectLocalStorage;
2589 2620
2590 String get typeName() native; 2621 String get typeName() native;
2591 } 2622 }
2592 2623
2593 class HTMLDListElement extends HTMLElement native "*HTMLDListElement" { 2624 class HTMLDListElement extends HTMLElement native "*HTMLDListElement" {
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4199 4230
4200 void setExtensionAPI(String script) native; 4231 void setExtensionAPI(String script) native;
4201 4232
4202 void showContextMenu(MouseEvent event, Object items) native; 4233 void showContextMenu(MouseEvent event, Object items) native;
4203 4234
4204 var dartObjectLocalStorage; 4235 var dartObjectLocalStorage;
4205 4236
4206 String get typeName() native; 4237 String get typeName() native;
4207 } 4238 }
4208 4239
4209 class Int16Array extends ArrayBufferView native "*Int16Array" { 4240 class Int16Array extends ArrayBufferView implements List<int> native "Int16Array " {
4241
4242 factory Int16Array(int length) => _construct(length);
4243
4244 factory Int16Array.fromList(List<int> list) => _construct(list);
4245
4246 factory Int16Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4247
4248 static _construct(arg) native 'return new Int16Array(arg);';
4210 4249
4211 static final int BYTES_PER_ELEMENT = 2; 4250 static final int BYTES_PER_ELEMENT = 2;
4212 4251
4213 int length; 4252 int length;
4214 4253
4254 int operator[](int index) native;
4255
4256 void operator[]=(int index, int value) native;
4257
4215 Int16Array subarray(int start, [int end = null]) native; 4258 Int16Array subarray(int start, [int end = null]) native;
4216 } 4259 }
4217 4260
4218 class Int32Array extends ArrayBufferView native "*Int32Array" { 4261 class Int32Array extends ArrayBufferView implements List<int> native "Int32Array " {
4262
4263 factory Int32Array(int length) => _construct(length);
4264
4265 factory Int32Array.fromList(List<int> list) => _construct(list);
4266
4267 factory Int32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4268
4269 static _construct(arg) native 'return new Int32Array(arg);';
4219 4270
4220 static final int BYTES_PER_ELEMENT = 4; 4271 static final int BYTES_PER_ELEMENT = 4;
4221 4272
4222 int length; 4273 int length;
4223 4274
4275 int operator[](int index) native;
4276
4277 void operator[]=(int index, int value) native;
4278
4224 Int32Array subarray(int start, [int end = null]) native; 4279 Int32Array subarray(int start, [int end = null]) native;
4225 } 4280 }
4226 4281
4227 class Int8Array extends ArrayBufferView native "*Int8Array" { 4282 class Int8Array extends ArrayBufferView implements List<int> native "Int8Array" {
4283
4284 factory Int8Array(int length) => _construct(length);
4285
4286 factory Int8Array.fromList(List<int> list) => _construct(list);
4287
4288 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
4289
4290 static _construct(arg) native 'return new Int8Array(arg);';
4228 4291
4229 static final int BYTES_PER_ELEMENT = 1; 4292 static final int BYTES_PER_ELEMENT = 1;
4230 4293
4231 int length; 4294 int length;
4232 4295
4296 int operator[](int index) native;
4297
4298 void operator[]=(int index, int value) native;
4299
4233 Int8Array subarray(int start, [int end = null]) native; 4300 Int8Array subarray(int start, [int end = null]) native;
4234 } 4301 }
4235 4302
4236 class JavaScriptAudioNode extends AudioNode native "*JavaScriptAudioNode" { 4303 class JavaScriptAudioNode extends AudioNode native "*JavaScriptAudioNode" {
4237 4304
4238 int bufferSize; 4305 int bufferSize;
4239 } 4306 }
4240 4307
4241 class JavaScriptCallFrame native "*JavaScriptCallFrame" { 4308 class JavaScriptCallFrame native "*JavaScriptCallFrame" {
4242 4309
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4357 } 4424 }
4358 4425
4359 class MediaList native "*MediaList" { 4426 class MediaList native "*MediaList" {
4360 4427
4361 int length; 4428 int length;
4362 4429
4363 String mediaText; 4430 String mediaText;
4364 4431
4365 String operator[](int index) native; 4432 String operator[](int index) native;
4366 4433
4434 void operator[]=(int index, String value) {
4435 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4436 }
4437
4367 void appendMedium(String newMedium) native; 4438 void appendMedium(String newMedium) native;
4368 4439
4369 void deleteMedium(String oldMedium) native; 4440 void deleteMedium(String oldMedium) native;
4370 4441
4371 String item(int index) native; 4442 String item(int index) native;
4372 4443
4373 var dartObjectLocalStorage; 4444 var dartObjectLocalStorage;
4374 4445
4375 String get typeName() native; 4446 String get typeName() native;
4376 } 4447 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 4632
4562 String get typeName() native; 4633 String get typeName() native;
4563 } 4634 }
4564 4635
4565 class NamedNodeMap native "*NamedNodeMap" { 4636 class NamedNodeMap native "*NamedNodeMap" {
4566 4637
4567 int length; 4638 int length;
4568 4639
4569 Node operator[](int index) native; 4640 Node operator[](int index) native;
4570 4641
4642 void operator[]=(int index, Node value) {
4643 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4644 }
4645
4571 Node getNamedItem(String name) native; 4646 Node getNamedItem(String name) native;
4572 4647
4573 Node getNamedItemNS(String namespaceURI, String localName) native; 4648 Node getNamedItemNS(String namespaceURI, String localName) native;
4574 4649
4575 Node item(int index) native; 4650 Node item(int index) native;
4576 4651
4577 Node removeNamedItem(String name) native; 4652 Node removeNamedItem(String name) native;
4578 4653
4579 Node removeNamedItemNS(String namespaceURI, String localName) native; 4654 Node removeNamedItemNS(String namespaceURI, String localName) native;
4580 4655
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4824 4899
4825 String get typeName() native; 4900 String get typeName() native;
4826 } 4901 }
4827 4902
4828 class NodeList native "*NodeList" { 4903 class NodeList native "*NodeList" {
4829 4904
4830 int length; 4905 int length;
4831 4906
4832 Node operator[](int index) native; 4907 Node operator[](int index) native;
4833 4908
4909 void operator[]=(int index, Node value) {
4910 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
4911 }
4912
4834 Node item(int index) native; 4913 Node item(int index) native;
4835 4914
4836 var dartObjectLocalStorage; 4915 var dartObjectLocalStorage;
4837 4916
4838 String get typeName() native; 4917 String get typeName() native;
4839 } 4918 }
4840 4919
4841 class NodeSelector native "*NodeSelector" { 4920 class NodeSelector native "*NodeSelector" {
4842 4921
4843 Element querySelector(String selectors) native; 4922 Element querySelector(String selectors) native;
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
8921 9000
8922 String get typeName() native; 9001 String get typeName() native;
8923 } 9002 }
8924 9003
8925 class StyleSheetList native "*StyleSheetList" { 9004 class StyleSheetList native "*StyleSheetList" {
8926 9005
8927 int length; 9006 int length;
8928 9007
8929 StyleSheet operator[](int index) native; 9008 StyleSheet operator[](int index) native;
8930 9009
9010 void operator[]=(int index, StyleSheet value) {
9011 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
9012 }
9013
8931 StyleSheet item(int index) native; 9014 StyleSheet item(int index) native;
8932 9015
8933 var dartObjectLocalStorage; 9016 var dartObjectLocalStorage;
8934 9017
8935 String get typeName() native; 9018 String get typeName() native;
8936 } 9019 }
8937 9020
8938 class Text extends CharacterData native "Text" { 9021 class Text extends CharacterData native "Text" {
8939 9022
8940 String wholeText; 9023 String wholeText;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
9107 9190
9108 void initTouchEvent(TouchList touches, TouchList targetTouches, TouchList chan gedTouches, String type, DOMWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native; 9191 void initTouchEvent(TouchList touches, TouchList targetTouches, TouchList chan gedTouches, String type, DOMWindow view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) native;
9109 } 9192 }
9110 9193
9111 class TouchList native "*TouchList" { 9194 class TouchList native "*TouchList" {
9112 9195
9113 int length; 9196 int length;
9114 9197
9115 Touch operator[](int index) native; 9198 Touch operator[](int index) native;
9116 9199
9200 void operator[]=(int index, Touch value) {
9201 throw new UnsupportedOperationException("Cannot assign element of immutable List.");
9202 }
9203
9117 Touch item(int index) native; 9204 Touch item(int index) native;
9118 9205
9119 var dartObjectLocalStorage; 9206 var dartObjectLocalStorage;
9120 9207
9121 String get typeName() native; 9208 String get typeName() native;
9122 } 9209 }
9123 9210
9124 class TreeWalker native "*TreeWalker" { 9211 class TreeWalker native "*TreeWalker" {
9125 9212
9126 Node currentNode; 9213 Node currentNode;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
9168 9255
9169 int pageY; 9256 int pageY;
9170 9257
9171 DOMWindow view; 9258 DOMWindow view;
9172 9259
9173 int which; 9260 int which;
9174 9261
9175 void initUIEvent(String type, bool canBubble, bool cancelable, DOMWindow view, int detail) native; 9262 void initUIEvent(String type, bool canBubble, bool cancelable, DOMWindow view, int detail) native;
9176 } 9263 }
9177 9264
9178 class Uint16Array extends ArrayBufferView native "*Uint16Array" { 9265 class Uint16Array extends ArrayBufferView implements List<int> native "Uint16Arr ay" {
9266
9267 factory Uint16Array(int length) => _construct(length);
9268
9269 factory Uint16Array.fromList(List<int> list) => _construct(list);
9270
9271 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9272
9273 static _construct(arg) native 'return new Uint16Array(arg);';
9179 9274
9180 static final int BYTES_PER_ELEMENT = 2; 9275 static final int BYTES_PER_ELEMENT = 2;
9181 9276
9182 int length; 9277 int length;
9183 9278
9279 int operator[](int index) native;
9280
9281 void operator[]=(int index, int value) native;
9282
9184 Uint16Array subarray(int start, [int end = null]) native; 9283 Uint16Array subarray(int start, [int end = null]) native;
9185 } 9284 }
9186 9285
9187 class Uint32Array extends ArrayBufferView native "*Uint32Array" { 9286 class Uint32Array extends ArrayBufferView implements List<int> native "Uint32Arr ay" {
9287
9288 factory Uint32Array(int length) => _construct(length);
9289
9290 factory Uint32Array.fromList(List<int> list) => _construct(list);
9291
9292 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9293
9294 static _construct(arg) native 'return new Uint32Array(arg);';
9188 9295
9189 static final int BYTES_PER_ELEMENT = 4; 9296 static final int BYTES_PER_ELEMENT = 4;
9190 9297
9191 int length; 9298 int length;
9192 9299
9300 int operator[](int index) native;
9301
9302 void operator[]=(int index, int value) native;
9303
9193 Uint32Array subarray(int start, [int end = null]) native; 9304 Uint32Array subarray(int start, [int end = null]) native;
9194 } 9305 }
9195 9306
9196 class Uint8Array extends ArrayBufferView native "*Uint8Array" { 9307 class Uint8Array extends ArrayBufferView implements List<int> native "Uint8Array " {
9308
9309 factory Uint8Array(int length) => _construct(length);
9310
9311 factory Uint8Array.fromList(List<int> list) => _construct(list);
9312
9313 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _construct(buffer);
9314
9315 static _construct(arg) native 'return new Uint8Array(arg);';
9197 9316
9198 static final int BYTES_PER_ELEMENT = 1; 9317 static final int BYTES_PER_ELEMENT = 1;
9199 9318
9200 int length; 9319 int length;
9201 9320
9321 int operator[](int index) native;
9322
9323 void operator[]=(int index, int value) native;
9324
9202 Uint8Array subarray(int start, [int end = null]) native; 9325 Uint8Array subarray(int start, [int end = null]) native;
9203 } 9326 }
9204 9327
9205 class ValidityState native "*ValidityState" { 9328 class ValidityState native "*ValidityState" {
9206 9329
9207 bool customError; 9330 bool customError;
9208 9331
9209 bool patternMismatch; 9332 bool patternMismatch;
9210 9333
9211 bool rangeOverflow; 9334 bool rangeOverflow;
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
11052 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 11175 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11053 // for details. All rights reserved. Use of this source code is governed by a 11176 // for details. All rights reserved. Use of this source code is governed by a
11054 // BSD-style license that can be found in the LICENSE file. 11177 // BSD-style license that can be found in the LICENSE file.
11055 11178
11056 typedef bool RequestAnimationFrameCallback(int time); 11179 typedef bool RequestAnimationFrameCallback(int time);
11057 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 11180 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11058 // for details. All rights reserved. Use of this source code is governed by a 11181 // for details. All rights reserved. Use of this source code is governed by a
11059 // BSD-style license that can be found in the LICENSE file. 11182 // BSD-style license that can be found in the LICENSE file.
11060 11183
11061 typedef void TimeoutHandler(); 11184 typedef void TimeoutHandler();
11185 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11186 // for details. All rights reserved. Use of this source code is governed by a
11187 // BSD-style license that can be found in the LICENSE file.
11188
11189 /**
11190 * The [Collections] class implements static methods useful when
11191 * writing a class that implements [Collection] and the [iterator]
11192 * method.
11193 */
11194 class _Collections {
11195 static void forEach(Iterable<Object> iterable, void f(Object o)) {
11196 for (final e in iterable) {
11197 f(e);
11198 }
11199 }
11200
11201 static bool some(Iterable<Object> iterable, bool f(Object o)) {
11202 for (final e in iterable) {
11203 if (f(e)) return true;
11204 }
11205 return false;
11206 }
11207
11208 static bool every(Iterable<Object> iterable, bool f(Object o)) {
11209 for (final e in iterable) {
11210 if (!f(e)) return false;
11211 }
11212 return true;
11213 }
11214
11215 static List filter(Iterable<Object> source,
11216 List<Object> destination,
11217 bool f(o)) {
11218 for (final e in source) {
11219 if (f(e)) destination.add(e);
11220 }
11221 return destination;
11222 }
11223
11224 static bool isEmpty(Iterable<Object> iterable) {
11225 return !iterable.iterator().hasNext();
11226 }
11227 }
11228 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11229 // for details. All rights reserved. Use of this source code is governed by a
11230 // BSD-style license that can be found in the LICENSE file.
11231
11232 // Iterator for arrays with fixed size.
11233 class _FixedSizeListIterator<T> extends _VariableSizeListIterator<T> {
11234 _FixedSizeListIterator(List<T> array)
11235 : super(array),
11236 _length = array.length;
11237
11238 bool hasNext() => _length > _pos;
11239
11240 final int _length; // Cache array length for faster access.
11241 }
11242
11243 // Iterator for arrays with variable size.
11244 class _VariableSizeListIterator<T> implements Iterator<T> {
11245 _VariableSizeListIterator(List<T> array)
11246 : _array = array,
11247 _pos = 0;
11248
11249 bool hasNext() => _array.length > _pos;
11250
11251 T next() {
11252 if (!hasNext()) {
11253 throw const NoMoreElementsException();
11254 }
11255 return _array[_pos++];
11256 }
11257
11258 final List<T> _array;
11259 int _pos;
11260 }
11261 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
11262 // for details. All rights reserved. Use of this source code is governed by a
11263 // BSD-style license that can be found in the LICENSE file.
11264
11265 class _Lists {
11266
11267 /**
11268 * Returns the index in the array [a] of the given [element], starting
11269 * the search at index [startIndex] to [endIndex] (exclusive).
11270 * Returns -1 if [element] is not found.
11271 */
11272 static int indexOf(List a,
11273 Object element,
11274 int startIndex,
11275 int endIndex) {
11276 if (startIndex >= a.length) {
11277 return -1;
11278 }
11279 if (startIndex < 0) {
11280 startIndex = 0;
11281 }
11282 for (int i = startIndex; i < endIndex; i++) {
11283 if (a[i] == element) {
11284 return i;
11285 }
11286 }
11287 return -1;
11288 }
11289
11290 /**
11291 * Returns the last index in the array [a] of the given [element], starting
11292 * the search at index [startIndex] to 0.
11293 * Returns -1 if [element] is not found.
11294 */
11295 static int lastIndexOf(List a, Object element, int startIndex) {
11296 if (startIndex < 0) {
11297 return -1;
11298 }
11299 if (startIndex >= a.length) {
11300 startIndex = a.length - 1;
11301 }
11302 for (int i = startIndex; i >= 0; i--) {
11303 if (a[i] == element) {
11304 return i;
11305 }
11306 }
11307 return -1;
11308 }
11309 }
OLDNEW
« no previous file with comments | « no previous file | client/dom/frog_dom.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698