OLD | NEW |
1 library svg; | 1 library svg; |
2 | 2 |
3 import 'dart:collection'; | 3 import 'dart:collection'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
6 import 'dart:nativewrappers'; | 6 import 'dart:nativewrappers'; |
7 // DO NOT EDIT | 7 // DO NOT EDIT |
8 // Auto-generated dart:svg library. | 8 // Auto-generated dart:svg library. |
9 | 9 |
10 | 10 |
(...skipping 3524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 Length operator[](int index) native "SVGLengthList_item_Callback"; | 3535 Length operator[](int index) native "SVGLengthList_item_Callback"; |
3536 | 3536 |
3537 void operator[]=(int index, Length value) { | 3537 void operator[]=(int index, Length value) { |
3538 throw new UnsupportedError("Cannot assign element of immutable List."); | 3538 throw new UnsupportedError("Cannot assign element of immutable List."); |
3539 } | 3539 } |
3540 // -- start List<Length> mixins. | 3540 // -- start List<Length> mixins. |
3541 // Length is the element type. | 3541 // Length is the element type. |
3542 | 3542 |
3543 // From Iterable<Length>: | 3543 // From Iterable<Length>: |
3544 | 3544 |
3545 Iterator<Length> iterator() { | 3545 Iterator<Length> get iterator { |
3546 // Note: NodeLists are not fixed size. And most probably length shouldn't | 3546 // Note: NodeLists are not fixed size. And most probably length shouldn't |
3547 // be cached in both iterator _and_ forEach method. For now caching it | 3547 // be cached in both iterator _and_ forEach method. For now caching it |
3548 // for consistency. | 3548 // for consistency. |
3549 return new FixedSizeListIterator<Length>(this); | 3549 return new FixedSizeListIterator<Length>(this); |
3550 } | 3550 } |
3551 | 3551 |
3552 // From Collection<Length>: | |
3553 // SVG Collections expose numberOfItems rather than length. | 3552 // SVG Collections expose numberOfItems rather than length. |
3554 int get length => numberOfItems; | 3553 int get length => numberOfItems; |
3555 | |
3556 void add(Length value) { | |
3557 throw new UnsupportedError("Cannot add to immutable List."); | |
3558 } | |
3559 | |
3560 void addLast(Length value) { | |
3561 throw new UnsupportedError("Cannot add to immutable List."); | |
3562 } | |
3563 | |
3564 void addAll(Collection<Length> collection) { | |
3565 throw new UnsupportedError("Cannot add to immutable List."); | |
3566 } | |
3567 | |
3568 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { | 3554 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { |
3569 return Collections.reduce(this, initialValue, combine); | 3555 return Collections.reduce(this, initialValue, combine); |
3570 } | 3556 } |
3571 | 3557 |
3572 bool contains(Length element) => Collections.contains(this, element); | 3558 bool contains(Length element) => Collections.contains(this, element); |
3573 | 3559 |
3574 void forEach(void f(Length element)) => Collections.forEach(this, f); | 3560 void forEach(void f(Length element)) => Collections.forEach(this, f); |
3575 | 3561 |
3576 Collection map(f(Length element)) => Collections.map(this, [], f); | 3562 String join([String separator]) => Collections.joinList(this, separator); |
3577 | 3563 |
3578 Collection<Length> filter(bool f(Length element)) => | 3564 List mappedBy(f(Length element)) => new MappedList<Length, dynamic>(this, f); |
3579 Collections.filter(this, <Length>[], f); | 3565 |
| 3566 Iterable<Length> where(bool f(Length element)) => new WhereIterable<Length>(th
is, f); |
3580 | 3567 |
3581 bool every(bool f(Length element)) => Collections.every(this, f); | 3568 bool every(bool f(Length element)) => Collections.every(this, f); |
3582 | 3569 |
3583 bool some(bool f(Length element)) => Collections.some(this, f); | 3570 bool any(bool f(Length element)) => Collections.any(this, f); |
3584 | 3571 |
3585 bool get isEmpty => this.length == 0; | 3572 bool get isEmpty => this.length == 0; |
3586 | 3573 |
| 3574 List<Length> take(int n) => new ListView<Length>(this, 0, n); |
| 3575 |
| 3576 Iterable<Length> takeWhile(bool test(Length value)) { |
| 3577 return new TakeWhileIterable<Length>(this, test); |
| 3578 } |
| 3579 |
| 3580 List<Length> skip(int n) => new ListView<Length>(this, n, null); |
| 3581 |
| 3582 Iterable<Length> skipWhile(bool test(Length value)) { |
| 3583 return new SkipWhileIterable<Length>(this, test); |
| 3584 } |
| 3585 |
| 3586 Length firstMatching(bool test(Length value), { Length orElse() }) { |
| 3587 return Collections.firstMatching(this, test, orElse); |
| 3588 } |
| 3589 |
| 3590 Length lastMatching(bool test(Length value), {Length orElse()}) { |
| 3591 return Collections.lastMatchingInList(this, test, orElse); |
| 3592 } |
| 3593 |
| 3594 Length singleMatching(bool test(Length value)) { |
| 3595 return Collections.singleMatching(this, test); |
| 3596 } |
| 3597 |
| 3598 Length elementAt(int index) { |
| 3599 return this[index]; |
| 3600 } |
| 3601 |
| 3602 // From Collection<Length>: |
| 3603 |
| 3604 void add(Length value) { |
| 3605 throw new UnsupportedError("Cannot add to immutable List."); |
| 3606 } |
| 3607 |
| 3608 void addLast(Length value) { |
| 3609 throw new UnsupportedError("Cannot add to immutable List."); |
| 3610 } |
| 3611 |
| 3612 void addAll(Iterable<Length> iterable) { |
| 3613 throw new UnsupportedError("Cannot add to immutable List."); |
| 3614 } |
| 3615 |
3587 // From List<Length>: | 3616 // From List<Length>: |
3588 void set length(int value) { | 3617 void set length(int value) { |
3589 throw new UnsupportedError("Cannot resize immutable List."); | 3618 throw new UnsupportedError("Cannot resize immutable List."); |
3590 } | 3619 } |
3591 | 3620 |
3592 // contains() defined by IDL. | 3621 // contains() defined by IDL. |
3593 | 3622 |
3594 void sort([int compare(Length a, Length b)]) { | 3623 void sort([int compare(Length a, Length b)]) { |
3595 throw new UnsupportedError("Cannot sort immutable List."); | 3624 throw new UnsupportedError("Cannot sort immutable List."); |
3596 } | 3625 } |
3597 | 3626 |
3598 int indexOf(Length element, [int start = 0]) => | 3627 int indexOf(Length element, [int start = 0]) => |
3599 Lists.indexOf(this, element, start, this.length); | 3628 Lists.indexOf(this, element, start, this.length); |
3600 | 3629 |
3601 int lastIndexOf(Length element, [int start]) { | 3630 int lastIndexOf(Length element, [int start]) { |
3602 if (start == null) start = length - 1; | 3631 if (start == null) start = length - 1; |
3603 return Lists.lastIndexOf(this, element, start); | 3632 return Lists.lastIndexOf(this, element, start); |
3604 } | 3633 } |
3605 | 3634 |
3606 Length get first => this[0]; | 3635 Length get first { |
| 3636 if (this.length > 0) return this[0]; |
| 3637 throw new StateError("No elements"); |
| 3638 } |
3607 | 3639 |
3608 Length get last => this[length - 1]; | 3640 Length get last { |
| 3641 if (this.length > 0) return this[this.length - 1]; |
| 3642 throw new StateError("No elements"); |
| 3643 } |
| 3644 |
| 3645 Length get single { |
| 3646 if (length == 1) return this[0]; |
| 3647 if (length == 0) throw new StateError("No elements"); |
| 3648 throw new StateError("More than one element"); |
| 3649 } |
| 3650 |
| 3651 Length min([int compare(Length a, Length b)]) => _Collections.minInList(this,
compare); |
| 3652 |
| 3653 Length max([int compare(Length a, Length b)]) => _Collections.maxInList(this,
compare); |
3609 | 3654 |
3610 Length removeAt(int pos) { | 3655 Length removeAt(int pos) { |
3611 throw new UnsupportedError("Cannot removeAt on immutable List."); | 3656 throw new UnsupportedError("Cannot removeAt on immutable List."); |
3612 } | 3657 } |
3613 | 3658 |
3614 Length removeLast() { | 3659 Length removeLast() { |
3615 throw new UnsupportedError("Cannot removeLast on immutable List."); | 3660 throw new UnsupportedError("Cannot removeLast on immutable List."); |
3616 } | 3661 } |
3617 | 3662 |
3618 void setRange(int start, int rangeLength, List<Length> from, [int startFrom])
{ | 3663 void setRange(int start, int rangeLength, List<Length> from, [int startFrom])
{ |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4214 Number operator[](int index) native "SVGNumberList_item_Callback"; | 4259 Number operator[](int index) native "SVGNumberList_item_Callback"; |
4215 | 4260 |
4216 void operator[]=(int index, Number value) { | 4261 void operator[]=(int index, Number value) { |
4217 throw new UnsupportedError("Cannot assign element of immutable List."); | 4262 throw new UnsupportedError("Cannot assign element of immutable List."); |
4218 } | 4263 } |
4219 // -- start List<Number> mixins. | 4264 // -- start List<Number> mixins. |
4220 // Number is the element type. | 4265 // Number is the element type. |
4221 | 4266 |
4222 // From Iterable<Number>: | 4267 // From Iterable<Number>: |
4223 | 4268 |
4224 Iterator<Number> iterator() { | 4269 Iterator<Number> get iterator { |
4225 // Note: NodeLists are not fixed size. And most probably length shouldn't | 4270 // Note: NodeLists are not fixed size. And most probably length shouldn't |
4226 // be cached in both iterator _and_ forEach method. For now caching it | 4271 // be cached in both iterator _and_ forEach method. For now caching it |
4227 // for consistency. | 4272 // for consistency. |
4228 return new FixedSizeListIterator<Number>(this); | 4273 return new FixedSizeListIterator<Number>(this); |
4229 } | 4274 } |
4230 | 4275 |
4231 // From Collection<Number>: | |
4232 // SVG Collections expose numberOfItems rather than length. | 4276 // SVG Collections expose numberOfItems rather than length. |
4233 int get length => numberOfItems; | 4277 int get length => numberOfItems; |
4234 | |
4235 void add(Number value) { | |
4236 throw new UnsupportedError("Cannot add to immutable List."); | |
4237 } | |
4238 | |
4239 void addLast(Number value) { | |
4240 throw new UnsupportedError("Cannot add to immutable List."); | |
4241 } | |
4242 | |
4243 void addAll(Collection<Number> collection) { | |
4244 throw new UnsupportedError("Cannot add to immutable List."); | |
4245 } | |
4246 | |
4247 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { | 4278 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { |
4248 return Collections.reduce(this, initialValue, combine); | 4279 return Collections.reduce(this, initialValue, combine); |
4249 } | 4280 } |
4250 | 4281 |
4251 bool contains(Number element) => Collections.contains(this, element); | 4282 bool contains(Number element) => Collections.contains(this, element); |
4252 | 4283 |
4253 void forEach(void f(Number element)) => Collections.forEach(this, f); | 4284 void forEach(void f(Number element)) => Collections.forEach(this, f); |
4254 | 4285 |
4255 Collection map(f(Number element)) => Collections.map(this, [], f); | 4286 String join([String separator]) => Collections.joinList(this, separator); |
4256 | 4287 |
4257 Collection<Number> filter(bool f(Number element)) => | 4288 List mappedBy(f(Number element)) => new MappedList<Number, dynamic>(this, f); |
4258 Collections.filter(this, <Number>[], f); | 4289 |
| 4290 Iterable<Number> where(bool f(Number element)) => new WhereIterable<Number>(th
is, f); |
4259 | 4291 |
4260 bool every(bool f(Number element)) => Collections.every(this, f); | 4292 bool every(bool f(Number element)) => Collections.every(this, f); |
4261 | 4293 |
4262 bool some(bool f(Number element)) => Collections.some(this, f); | 4294 bool any(bool f(Number element)) => Collections.any(this, f); |
4263 | 4295 |
4264 bool get isEmpty => this.length == 0; | 4296 bool get isEmpty => this.length == 0; |
4265 | 4297 |
| 4298 List<Number> take(int n) => new ListView<Number>(this, 0, n); |
| 4299 |
| 4300 Iterable<Number> takeWhile(bool test(Number value)) { |
| 4301 return new TakeWhileIterable<Number>(this, test); |
| 4302 } |
| 4303 |
| 4304 List<Number> skip(int n) => new ListView<Number>(this, n, null); |
| 4305 |
| 4306 Iterable<Number> skipWhile(bool test(Number value)) { |
| 4307 return new SkipWhileIterable<Number>(this, test); |
| 4308 } |
| 4309 |
| 4310 Number firstMatching(bool test(Number value), { Number orElse() }) { |
| 4311 return Collections.firstMatching(this, test, orElse); |
| 4312 } |
| 4313 |
| 4314 Number lastMatching(bool test(Number value), {Number orElse()}) { |
| 4315 return Collections.lastMatchingInList(this, test, orElse); |
| 4316 } |
| 4317 |
| 4318 Number singleMatching(bool test(Number value)) { |
| 4319 return Collections.singleMatching(this, test); |
| 4320 } |
| 4321 |
| 4322 Number elementAt(int index) { |
| 4323 return this[index]; |
| 4324 } |
| 4325 |
| 4326 // From Collection<Number>: |
| 4327 |
| 4328 void add(Number value) { |
| 4329 throw new UnsupportedError("Cannot add to immutable List."); |
| 4330 } |
| 4331 |
| 4332 void addLast(Number value) { |
| 4333 throw new UnsupportedError("Cannot add to immutable List."); |
| 4334 } |
| 4335 |
| 4336 void addAll(Iterable<Number> iterable) { |
| 4337 throw new UnsupportedError("Cannot add to immutable List."); |
| 4338 } |
| 4339 |
4266 // From List<Number>: | 4340 // From List<Number>: |
4267 void set length(int value) { | 4341 void set length(int value) { |
4268 throw new UnsupportedError("Cannot resize immutable List."); | 4342 throw new UnsupportedError("Cannot resize immutable List."); |
4269 } | 4343 } |
4270 | 4344 |
4271 // contains() defined by IDL. | 4345 // contains() defined by IDL. |
4272 | 4346 |
4273 void sort([int compare(Number a, Number b)]) { | 4347 void sort([int compare(Number a, Number b)]) { |
4274 throw new UnsupportedError("Cannot sort immutable List."); | 4348 throw new UnsupportedError("Cannot sort immutable List."); |
4275 } | 4349 } |
4276 | 4350 |
4277 int indexOf(Number element, [int start = 0]) => | 4351 int indexOf(Number element, [int start = 0]) => |
4278 Lists.indexOf(this, element, start, this.length); | 4352 Lists.indexOf(this, element, start, this.length); |
4279 | 4353 |
4280 int lastIndexOf(Number element, [int start]) { | 4354 int lastIndexOf(Number element, [int start]) { |
4281 if (start == null) start = length - 1; | 4355 if (start == null) start = length - 1; |
4282 return Lists.lastIndexOf(this, element, start); | 4356 return Lists.lastIndexOf(this, element, start); |
4283 } | 4357 } |
4284 | 4358 |
4285 Number get first => this[0]; | 4359 Number get first { |
| 4360 if (this.length > 0) return this[0]; |
| 4361 throw new StateError("No elements"); |
| 4362 } |
4286 | 4363 |
4287 Number get last => this[length - 1]; | 4364 Number get last { |
| 4365 if (this.length > 0) return this[this.length - 1]; |
| 4366 throw new StateError("No elements"); |
| 4367 } |
| 4368 |
| 4369 Number get single { |
| 4370 if (length == 1) return this[0]; |
| 4371 if (length == 0) throw new StateError("No elements"); |
| 4372 throw new StateError("More than one element"); |
| 4373 } |
| 4374 |
| 4375 Number min([int compare(Number a, Number b)]) => _Collections.minInList(this,
compare); |
| 4376 |
| 4377 Number max([int compare(Number a, Number b)]) => _Collections.maxInList(this,
compare); |
4288 | 4378 |
4289 Number removeAt(int pos) { | 4379 Number removeAt(int pos) { |
4290 throw new UnsupportedError("Cannot removeAt on immutable List."); | 4380 throw new UnsupportedError("Cannot removeAt on immutable List."); |
4291 } | 4381 } |
4292 | 4382 |
4293 Number removeLast() { | 4383 Number removeLast() { |
4294 throw new UnsupportedError("Cannot removeLast on immutable List."); | 4384 throw new UnsupportedError("Cannot removeLast on immutable List."); |
4295 } | 4385 } |
4296 | 4386 |
4297 void setRange(int start, int rangeLength, List<Number> from, [int startFrom])
{ | 4387 void setRange(int start, int rangeLength, List<Number> from, [int startFrom])
{ |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 PathSeg operator[](int index) native "SVGPathSegList_item_Callback"; | 5391 PathSeg operator[](int index) native "SVGPathSegList_item_Callback"; |
5302 | 5392 |
5303 void operator[]=(int index, PathSeg value) { | 5393 void operator[]=(int index, PathSeg value) { |
5304 throw new UnsupportedError("Cannot assign element of immutable List."); | 5394 throw new UnsupportedError("Cannot assign element of immutable List."); |
5305 } | 5395 } |
5306 // -- start List<PathSeg> mixins. | 5396 // -- start List<PathSeg> mixins. |
5307 // PathSeg is the element type. | 5397 // PathSeg is the element type. |
5308 | 5398 |
5309 // From Iterable<PathSeg>: | 5399 // From Iterable<PathSeg>: |
5310 | 5400 |
5311 Iterator<PathSeg> iterator() { | 5401 Iterator<PathSeg> get iterator { |
5312 // Note: NodeLists are not fixed size. And most probably length shouldn't | 5402 // Note: NodeLists are not fixed size. And most probably length shouldn't |
5313 // be cached in both iterator _and_ forEach method. For now caching it | 5403 // be cached in both iterator _and_ forEach method. For now caching it |
5314 // for consistency. | 5404 // for consistency. |
5315 return new FixedSizeListIterator<PathSeg>(this); | 5405 return new FixedSizeListIterator<PathSeg>(this); |
5316 } | 5406 } |
5317 | 5407 |
5318 // From Collection<PathSeg>: | |
5319 // SVG Collections expose numberOfItems rather than length. | 5408 // SVG Collections expose numberOfItems rather than length. |
5320 int get length => numberOfItems; | 5409 int get length => numberOfItems; |
5321 | |
5322 void add(PathSeg value) { | |
5323 throw new UnsupportedError("Cannot add to immutable List."); | |
5324 } | |
5325 | |
5326 void addLast(PathSeg value) { | |
5327 throw new UnsupportedError("Cannot add to immutable List."); | |
5328 } | |
5329 | |
5330 void addAll(Collection<PathSeg> collection) { | |
5331 throw new UnsupportedError("Cannot add to immutable List."); | |
5332 } | |
5333 | |
5334 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { | 5410 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { |
5335 return Collections.reduce(this, initialValue, combine); | 5411 return Collections.reduce(this, initialValue, combine); |
5336 } | 5412 } |
5337 | 5413 |
5338 bool contains(PathSeg element) => Collections.contains(this, element); | 5414 bool contains(PathSeg element) => Collections.contains(this, element); |
5339 | 5415 |
5340 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); | 5416 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); |
5341 | 5417 |
5342 Collection map(f(PathSeg element)) => Collections.map(this, [], f); | 5418 String join([String separator]) => Collections.joinList(this, separator); |
5343 | 5419 |
5344 Collection<PathSeg> filter(bool f(PathSeg element)) => | 5420 List mappedBy(f(PathSeg element)) => new MappedList<PathSeg, dynamic>(this, f)
; |
5345 Collections.filter(this, <PathSeg>[], f); | 5421 |
| 5422 Iterable<PathSeg> where(bool f(PathSeg element)) => new WhereIterable<PathSeg>
(this, f); |
5346 | 5423 |
5347 bool every(bool f(PathSeg element)) => Collections.every(this, f); | 5424 bool every(bool f(PathSeg element)) => Collections.every(this, f); |
5348 | 5425 |
5349 bool some(bool f(PathSeg element)) => Collections.some(this, f); | 5426 bool any(bool f(PathSeg element)) => Collections.any(this, f); |
5350 | 5427 |
5351 bool get isEmpty => this.length == 0; | 5428 bool get isEmpty => this.length == 0; |
5352 | 5429 |
| 5430 List<PathSeg> take(int n) => new ListView<PathSeg>(this, 0, n); |
| 5431 |
| 5432 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) { |
| 5433 return new TakeWhileIterable<PathSeg>(this, test); |
| 5434 } |
| 5435 |
| 5436 List<PathSeg> skip(int n) => new ListView<PathSeg>(this, n, null); |
| 5437 |
| 5438 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) { |
| 5439 return new SkipWhileIterable<PathSeg>(this, test); |
| 5440 } |
| 5441 |
| 5442 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) { |
| 5443 return Collections.firstMatching(this, test, orElse); |
| 5444 } |
| 5445 |
| 5446 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) { |
| 5447 return Collections.lastMatchingInList(this, test, orElse); |
| 5448 } |
| 5449 |
| 5450 PathSeg singleMatching(bool test(PathSeg value)) { |
| 5451 return Collections.singleMatching(this, test); |
| 5452 } |
| 5453 |
| 5454 PathSeg elementAt(int index) { |
| 5455 return this[index]; |
| 5456 } |
| 5457 |
| 5458 // From Collection<PathSeg>: |
| 5459 |
| 5460 void add(PathSeg value) { |
| 5461 throw new UnsupportedError("Cannot add to immutable List."); |
| 5462 } |
| 5463 |
| 5464 void addLast(PathSeg value) { |
| 5465 throw new UnsupportedError("Cannot add to immutable List."); |
| 5466 } |
| 5467 |
| 5468 void addAll(Iterable<PathSeg> iterable) { |
| 5469 throw new UnsupportedError("Cannot add to immutable List."); |
| 5470 } |
| 5471 |
5353 // From List<PathSeg>: | 5472 // From List<PathSeg>: |
5354 void set length(int value) { | 5473 void set length(int value) { |
5355 throw new UnsupportedError("Cannot resize immutable List."); | 5474 throw new UnsupportedError("Cannot resize immutable List."); |
5356 } | 5475 } |
5357 | 5476 |
5358 // contains() defined by IDL. | 5477 // contains() defined by IDL. |
5359 | 5478 |
5360 void sort([int compare(PathSeg a, PathSeg b)]) { | 5479 void sort([int compare(PathSeg a, PathSeg b)]) { |
5361 throw new UnsupportedError("Cannot sort immutable List."); | 5480 throw new UnsupportedError("Cannot sort immutable List."); |
5362 } | 5481 } |
5363 | 5482 |
5364 int indexOf(PathSeg element, [int start = 0]) => | 5483 int indexOf(PathSeg element, [int start = 0]) => |
5365 Lists.indexOf(this, element, start, this.length); | 5484 Lists.indexOf(this, element, start, this.length); |
5366 | 5485 |
5367 int lastIndexOf(PathSeg element, [int start]) { | 5486 int lastIndexOf(PathSeg element, [int start]) { |
5368 if (start == null) start = length - 1; | 5487 if (start == null) start = length - 1; |
5369 return Lists.lastIndexOf(this, element, start); | 5488 return Lists.lastIndexOf(this, element, start); |
5370 } | 5489 } |
5371 | 5490 |
5372 PathSeg get first => this[0]; | 5491 PathSeg get first { |
| 5492 if (this.length > 0) return this[0]; |
| 5493 throw new StateError("No elements"); |
| 5494 } |
5373 | 5495 |
5374 PathSeg get last => this[length - 1]; | 5496 PathSeg get last { |
| 5497 if (this.length > 0) return this[this.length - 1]; |
| 5498 throw new StateError("No elements"); |
| 5499 } |
| 5500 |
| 5501 PathSeg get single { |
| 5502 if (length == 1) return this[0]; |
| 5503 if (length == 0) throw new StateError("No elements"); |
| 5504 throw new StateError("More than one element"); |
| 5505 } |
| 5506 |
| 5507 PathSeg min([int compare(PathSeg a, PathSeg b)]) => _Collections.minInList(thi
s, compare); |
| 5508 |
| 5509 PathSeg max([int compare(PathSeg a, PathSeg b)]) => _Collections.maxInList(thi
s, compare); |
5375 | 5510 |
5376 PathSeg removeAt(int pos) { | 5511 PathSeg removeAt(int pos) { |
5377 throw new UnsupportedError("Cannot removeAt on immutable List."); | 5512 throw new UnsupportedError("Cannot removeAt on immutable List."); |
5378 } | 5513 } |
5379 | 5514 |
5380 PathSeg removeLast() { | 5515 PathSeg removeLast() { |
5381 throw new UnsupportedError("Cannot removeLast on immutable List."); | 5516 throw new UnsupportedError("Cannot removeLast on immutable List."); |
5382 } | 5517 } |
5383 | 5518 |
5384 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom])
{ | 5519 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom])
{ |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6233 String operator[](int index) native "SVGStringList_item_Callback"; | 6368 String operator[](int index) native "SVGStringList_item_Callback"; |
6234 | 6369 |
6235 void operator[]=(int index, String value) { | 6370 void operator[]=(int index, String value) { |
6236 throw new UnsupportedError("Cannot assign element of immutable List."); | 6371 throw new UnsupportedError("Cannot assign element of immutable List."); |
6237 } | 6372 } |
6238 // -- start List<String> mixins. | 6373 // -- start List<String> mixins. |
6239 // String is the element type. | 6374 // String is the element type. |
6240 | 6375 |
6241 // From Iterable<String>: | 6376 // From Iterable<String>: |
6242 | 6377 |
6243 Iterator<String> iterator() { | 6378 Iterator<String> get iterator { |
6244 // Note: NodeLists are not fixed size. And most probably length shouldn't | 6379 // Note: NodeLists are not fixed size. And most probably length shouldn't |
6245 // be cached in both iterator _and_ forEach method. For now caching it | 6380 // be cached in both iterator _and_ forEach method. For now caching it |
6246 // for consistency. | 6381 // for consistency. |
6247 return new FixedSizeListIterator<String>(this); | 6382 return new FixedSizeListIterator<String>(this); |
6248 } | 6383 } |
6249 | 6384 |
6250 // From Collection<String>: | |
6251 // SVG Collections expose numberOfItems rather than length. | 6385 // SVG Collections expose numberOfItems rather than length. |
6252 int get length => numberOfItems; | 6386 int get length => numberOfItems; |
6253 | |
6254 void add(String value) { | |
6255 throw new UnsupportedError("Cannot add to immutable List."); | |
6256 } | |
6257 | |
6258 void addLast(String value) { | |
6259 throw new UnsupportedError("Cannot add to immutable List."); | |
6260 } | |
6261 | |
6262 void addAll(Collection<String> collection) { | |
6263 throw new UnsupportedError("Cannot add to immutable List."); | |
6264 } | |
6265 | |
6266 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { | 6387 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { |
6267 return Collections.reduce(this, initialValue, combine); | 6388 return Collections.reduce(this, initialValue, combine); |
6268 } | 6389 } |
6269 | 6390 |
6270 bool contains(String element) => Collections.contains(this, element); | 6391 bool contains(String element) => Collections.contains(this, element); |
6271 | 6392 |
6272 void forEach(void f(String element)) => Collections.forEach(this, f); | 6393 void forEach(void f(String element)) => Collections.forEach(this, f); |
6273 | 6394 |
6274 Collection map(f(String element)) => Collections.map(this, [], f); | 6395 String join([String separator]) => Collections.joinList(this, separator); |
6275 | 6396 |
6276 Collection<String> filter(bool f(String element)) => | 6397 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); |
6277 Collections.filter(this, <String>[], f); | 6398 |
| 6399 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th
is, f); |
6278 | 6400 |
6279 bool every(bool f(String element)) => Collections.every(this, f); | 6401 bool every(bool f(String element)) => Collections.every(this, f); |
6280 | 6402 |
6281 bool some(bool f(String element)) => Collections.some(this, f); | 6403 bool any(bool f(String element)) => Collections.any(this, f); |
6282 | 6404 |
6283 bool get isEmpty => this.length == 0; | 6405 bool get isEmpty => this.length == 0; |
6284 | 6406 |
| 6407 List<String> take(int n) => new ListView<String>(this, 0, n); |
| 6408 |
| 6409 Iterable<String> takeWhile(bool test(String value)) { |
| 6410 return new TakeWhileIterable<String>(this, test); |
| 6411 } |
| 6412 |
| 6413 List<String> skip(int n) => new ListView<String>(this, n, null); |
| 6414 |
| 6415 Iterable<String> skipWhile(bool test(String value)) { |
| 6416 return new SkipWhileIterable<String>(this, test); |
| 6417 } |
| 6418 |
| 6419 String firstMatching(bool test(String value), { String orElse() }) { |
| 6420 return Collections.firstMatching(this, test, orElse); |
| 6421 } |
| 6422 |
| 6423 String lastMatching(bool test(String value), {String orElse()}) { |
| 6424 return Collections.lastMatchingInList(this, test, orElse); |
| 6425 } |
| 6426 |
| 6427 String singleMatching(bool test(String value)) { |
| 6428 return Collections.singleMatching(this, test); |
| 6429 } |
| 6430 |
| 6431 String elementAt(int index) { |
| 6432 return this[index]; |
| 6433 } |
| 6434 |
| 6435 // From Collection<String>: |
| 6436 |
| 6437 void add(String value) { |
| 6438 throw new UnsupportedError("Cannot add to immutable List."); |
| 6439 } |
| 6440 |
| 6441 void addLast(String value) { |
| 6442 throw new UnsupportedError("Cannot add to immutable List."); |
| 6443 } |
| 6444 |
| 6445 void addAll(Iterable<String> iterable) { |
| 6446 throw new UnsupportedError("Cannot add to immutable List."); |
| 6447 } |
| 6448 |
6285 // From List<String>: | 6449 // From List<String>: |
6286 void set length(int value) { | 6450 void set length(int value) { |
6287 throw new UnsupportedError("Cannot resize immutable List."); | 6451 throw new UnsupportedError("Cannot resize immutable List."); |
6288 } | 6452 } |
6289 | 6453 |
6290 // contains() defined by IDL. | 6454 // contains() defined by IDL. |
6291 | 6455 |
6292 void sort([int compare(String a, String b)]) { | 6456 void sort([int compare(String a, String b)]) { |
6293 throw new UnsupportedError("Cannot sort immutable List."); | 6457 throw new UnsupportedError("Cannot sort immutable List."); |
6294 } | 6458 } |
6295 | 6459 |
6296 int indexOf(String element, [int start = 0]) => | 6460 int indexOf(String element, [int start = 0]) => |
6297 Lists.indexOf(this, element, start, this.length); | 6461 Lists.indexOf(this, element, start, this.length); |
6298 | 6462 |
6299 int lastIndexOf(String element, [int start]) { | 6463 int lastIndexOf(String element, [int start]) { |
6300 if (start == null) start = length - 1; | 6464 if (start == null) start = length - 1; |
6301 return Lists.lastIndexOf(this, element, start); | 6465 return Lists.lastIndexOf(this, element, start); |
6302 } | 6466 } |
6303 | 6467 |
6304 String get first => this[0]; | 6468 String get first { |
| 6469 if (this.length > 0) return this[0]; |
| 6470 throw new StateError("No elements"); |
| 6471 } |
6305 | 6472 |
6306 String get last => this[length - 1]; | 6473 String get last { |
| 6474 if (this.length > 0) return this[this.length - 1]; |
| 6475 throw new StateError("No elements"); |
| 6476 } |
| 6477 |
| 6478 String get single { |
| 6479 if (length == 1) return this[0]; |
| 6480 if (length == 0) throw new StateError("No elements"); |
| 6481 throw new StateError("More than one element"); |
| 6482 } |
| 6483 |
| 6484 String min([int compare(String a, String b)]) => _Collections.minInList(this,
compare); |
| 6485 |
| 6486 String max([int compare(String a, String b)]) => _Collections.maxInList(this,
compare); |
6307 | 6487 |
6308 String removeAt(int pos) { | 6488 String removeAt(int pos) { |
6309 throw new UnsupportedError("Cannot removeAt on immutable List."); | 6489 throw new UnsupportedError("Cannot removeAt on immutable List."); |
6310 } | 6490 } |
6311 | 6491 |
6312 String removeLast() { | 6492 String removeLast() { |
6313 throw new UnsupportedError("Cannot removeLast on immutable List."); | 6493 throw new UnsupportedError("Cannot removeLast on immutable List."); |
6314 } | 6494 } |
6315 | 6495 |
6316 void setRange(int start, int rangeLength, List<String> from, [int startFrom])
{ | 6496 void setRange(int start, int rangeLength, List<String> from, [int startFrom])
{ |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7460 Transform operator[](int index) native "SVGTransformList_item_Callback"; | 7640 Transform operator[](int index) native "SVGTransformList_item_Callback"; |
7461 | 7641 |
7462 void operator[]=(int index, Transform value) { | 7642 void operator[]=(int index, Transform value) { |
7463 throw new UnsupportedError("Cannot assign element of immutable List."); | 7643 throw new UnsupportedError("Cannot assign element of immutable List."); |
7464 } | 7644 } |
7465 // -- start List<Transform> mixins. | 7645 // -- start List<Transform> mixins. |
7466 // Transform is the element type. | 7646 // Transform is the element type. |
7467 | 7647 |
7468 // From Iterable<Transform>: | 7648 // From Iterable<Transform>: |
7469 | 7649 |
7470 Iterator<Transform> iterator() { | 7650 Iterator<Transform> get iterator { |
7471 // Note: NodeLists are not fixed size. And most probably length shouldn't | 7651 // Note: NodeLists are not fixed size. And most probably length shouldn't |
7472 // be cached in both iterator _and_ forEach method. For now caching it | 7652 // be cached in both iterator _and_ forEach method. For now caching it |
7473 // for consistency. | 7653 // for consistency. |
7474 return new FixedSizeListIterator<Transform>(this); | 7654 return new FixedSizeListIterator<Transform>(this); |
7475 } | 7655 } |
7476 | 7656 |
7477 // From Collection<Transform>: | |
7478 // SVG Collections expose numberOfItems rather than length. | 7657 // SVG Collections expose numberOfItems rather than length. |
7479 int get length => numberOfItems; | 7658 int get length => numberOfItems; |
7480 | |
7481 void add(Transform value) { | |
7482 throw new UnsupportedError("Cannot add to immutable List."); | |
7483 } | |
7484 | |
7485 void addLast(Transform value) { | |
7486 throw new UnsupportedError("Cannot add to immutable List."); | |
7487 } | |
7488 | |
7489 void addAll(Collection<Transform> collection) { | |
7490 throw new UnsupportedError("Cannot add to immutable List."); | |
7491 } | |
7492 | |
7493 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { | 7659 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { |
7494 return Collections.reduce(this, initialValue, combine); | 7660 return Collections.reduce(this, initialValue, combine); |
7495 } | 7661 } |
7496 | 7662 |
7497 bool contains(Transform element) => Collections.contains(this, element); | 7663 bool contains(Transform element) => Collections.contains(this, element); |
7498 | 7664 |
7499 void forEach(void f(Transform element)) => Collections.forEach(this, f); | 7665 void forEach(void f(Transform element)) => Collections.forEach(this, f); |
7500 | 7666 |
7501 Collection map(f(Transform element)) => Collections.map(this, [], f); | 7667 String join([String separator]) => Collections.joinList(this, separator); |
7502 | 7668 |
7503 Collection<Transform> filter(bool f(Transform element)) => | 7669 List mappedBy(f(Transform element)) => new MappedList<Transform, dynamic>(this
, f); |
7504 Collections.filter(this, <Transform>[], f); | 7670 |
| 7671 Iterable<Transform> where(bool f(Transform element)) => new WhereIterable<Tran
sform>(this, f); |
7505 | 7672 |
7506 bool every(bool f(Transform element)) => Collections.every(this, f); | 7673 bool every(bool f(Transform element)) => Collections.every(this, f); |
7507 | 7674 |
7508 bool some(bool f(Transform element)) => Collections.some(this, f); | 7675 bool any(bool f(Transform element)) => Collections.any(this, f); |
7509 | 7676 |
7510 bool get isEmpty => this.length == 0; | 7677 bool get isEmpty => this.length == 0; |
7511 | 7678 |
| 7679 List<Transform> take(int n) => new ListView<Transform>(this, 0, n); |
| 7680 |
| 7681 Iterable<Transform> takeWhile(bool test(Transform value)) { |
| 7682 return new TakeWhileIterable<Transform>(this, test); |
| 7683 } |
| 7684 |
| 7685 List<Transform> skip(int n) => new ListView<Transform>(this, n, null); |
| 7686 |
| 7687 Iterable<Transform> skipWhile(bool test(Transform value)) { |
| 7688 return new SkipWhileIterable<Transform>(this, test); |
| 7689 } |
| 7690 |
| 7691 Transform firstMatching(bool test(Transform value), { Transform orElse() }) { |
| 7692 return Collections.firstMatching(this, test, orElse); |
| 7693 } |
| 7694 |
| 7695 Transform lastMatching(bool test(Transform value), {Transform orElse()}) { |
| 7696 return Collections.lastMatchingInList(this, test, orElse); |
| 7697 } |
| 7698 |
| 7699 Transform singleMatching(bool test(Transform value)) { |
| 7700 return Collections.singleMatching(this, test); |
| 7701 } |
| 7702 |
| 7703 Transform elementAt(int index) { |
| 7704 return this[index]; |
| 7705 } |
| 7706 |
| 7707 // From Collection<Transform>: |
| 7708 |
| 7709 void add(Transform value) { |
| 7710 throw new UnsupportedError("Cannot add to immutable List."); |
| 7711 } |
| 7712 |
| 7713 void addLast(Transform value) { |
| 7714 throw new UnsupportedError("Cannot add to immutable List."); |
| 7715 } |
| 7716 |
| 7717 void addAll(Iterable<Transform> iterable) { |
| 7718 throw new UnsupportedError("Cannot add to immutable List."); |
| 7719 } |
| 7720 |
7512 // From List<Transform>: | 7721 // From List<Transform>: |
7513 void set length(int value) { | 7722 void set length(int value) { |
7514 throw new UnsupportedError("Cannot resize immutable List."); | 7723 throw new UnsupportedError("Cannot resize immutable List."); |
7515 } | 7724 } |
7516 | 7725 |
7517 // contains() defined by IDL. | 7726 // contains() defined by IDL. |
7518 | 7727 |
7519 void sort([int compare(Transform a, Transform b)]) { | 7728 void sort([int compare(Transform a, Transform b)]) { |
7520 throw new UnsupportedError("Cannot sort immutable List."); | 7729 throw new UnsupportedError("Cannot sort immutable List."); |
7521 } | 7730 } |
7522 | 7731 |
7523 int indexOf(Transform element, [int start = 0]) => | 7732 int indexOf(Transform element, [int start = 0]) => |
7524 Lists.indexOf(this, element, start, this.length); | 7733 Lists.indexOf(this, element, start, this.length); |
7525 | 7734 |
7526 int lastIndexOf(Transform element, [int start]) { | 7735 int lastIndexOf(Transform element, [int start]) { |
7527 if (start == null) start = length - 1; | 7736 if (start == null) start = length - 1; |
7528 return Lists.lastIndexOf(this, element, start); | 7737 return Lists.lastIndexOf(this, element, start); |
7529 } | 7738 } |
7530 | 7739 |
7531 Transform get first => this[0]; | 7740 Transform get first { |
| 7741 if (this.length > 0) return this[0]; |
| 7742 throw new StateError("No elements"); |
| 7743 } |
7532 | 7744 |
7533 Transform get last => this[length - 1]; | 7745 Transform get last { |
| 7746 if (this.length > 0) return this[this.length - 1]; |
| 7747 throw new StateError("No elements"); |
| 7748 } |
| 7749 |
| 7750 Transform get single { |
| 7751 if (length == 1) return this[0]; |
| 7752 if (length == 0) throw new StateError("No elements"); |
| 7753 throw new StateError("More than one element"); |
| 7754 } |
| 7755 |
| 7756 Transform min([int compare(Transform a, Transform b)]) => _Collections.minInLi
st(this, compare); |
| 7757 |
| 7758 Transform max([int compare(Transform a, Transform b)]) => _Collections.maxInLi
st(this, compare); |
7534 | 7759 |
7535 Transform removeAt(int pos) { | 7760 Transform removeAt(int pos) { |
7536 throw new UnsupportedError("Cannot removeAt on immutable List."); | 7761 throw new UnsupportedError("Cannot removeAt on immutable List."); |
7537 } | 7762 } |
7538 | 7763 |
7539 Transform removeLast() { | 7764 Transform removeLast() { |
7540 throw new UnsupportedError("Cannot removeLast on immutable List."); | 7765 throw new UnsupportedError("Cannot removeLast on immutable List."); |
7541 } | 7766 } |
7542 | 7767 |
7543 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom
]) { | 7768 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom
]) { |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7969 ElementInstance operator[](int index) native "SVGElementInstanceList_item_Call
back"; | 8194 ElementInstance operator[](int index) native "SVGElementInstanceList_item_Call
back"; |
7970 | 8195 |
7971 void operator[]=(int index, ElementInstance value) { | 8196 void operator[]=(int index, ElementInstance value) { |
7972 throw new UnsupportedError("Cannot assign element of immutable List."); | 8197 throw new UnsupportedError("Cannot assign element of immutable List."); |
7973 } | 8198 } |
7974 // -- start List<ElementInstance> mixins. | 8199 // -- start List<ElementInstance> mixins. |
7975 // ElementInstance is the element type. | 8200 // ElementInstance is the element type. |
7976 | 8201 |
7977 // From Iterable<ElementInstance>: | 8202 // From Iterable<ElementInstance>: |
7978 | 8203 |
7979 Iterator<ElementInstance> iterator() { | 8204 Iterator<ElementInstance> get iterator { |
7980 // Note: NodeLists are not fixed size. And most probably length shouldn't | 8205 // Note: NodeLists are not fixed size. And most probably length shouldn't |
7981 // be cached in both iterator _and_ forEach method. For now caching it | 8206 // be cached in both iterator _and_ forEach method. For now caching it |
7982 // for consistency. | 8207 // for consistency. |
7983 return new FixedSizeListIterator<ElementInstance>(this); | 8208 return new FixedSizeListIterator<ElementInstance>(this); |
7984 } | 8209 } |
7985 | 8210 |
7986 // From Collection<ElementInstance>: | |
7987 | |
7988 void add(ElementInstance value) { | |
7989 throw new UnsupportedError("Cannot add to immutable List."); | |
7990 } | |
7991 | |
7992 void addLast(ElementInstance value) { | |
7993 throw new UnsupportedError("Cannot add to immutable List."); | |
7994 } | |
7995 | |
7996 void addAll(Collection<ElementInstance> collection) { | |
7997 throw new UnsupportedError("Cannot add to immutable List."); | |
7998 } | |
7999 | |
8000 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance)
) { | 8211 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance)
) { |
8001 return Collections.reduce(this, initialValue, combine); | 8212 return Collections.reduce(this, initialValue, combine); |
8002 } | 8213 } |
8003 | 8214 |
8004 bool contains(ElementInstance element) => Collections.contains(this, element); | 8215 bool contains(ElementInstance element) => Collections.contains(this, element); |
8005 | 8216 |
8006 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); | 8217 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); |
8007 | 8218 |
8008 Collection map(f(ElementInstance element)) => Collections.map(this, [], f); | 8219 String join([String separator]) => Collections.joinList(this, separator); |
8009 | 8220 |
8010 Collection<ElementInstance> filter(bool f(ElementInstance element)) => | 8221 List mappedBy(f(ElementInstance element)) => new MappedList<ElementInstance, d
ynamic>(this, f); |
8011 Collections.filter(this, <ElementInstance>[], f); | 8222 |
| 8223 Iterable<ElementInstance> where(bool f(ElementInstance element)) => new WhereI
terable<ElementInstance>(this, f); |
8012 | 8224 |
8013 bool every(bool f(ElementInstance element)) => Collections.every(this, f); | 8225 bool every(bool f(ElementInstance element)) => Collections.every(this, f); |
8014 | 8226 |
8015 bool some(bool f(ElementInstance element)) => Collections.some(this, f); | 8227 bool any(bool f(ElementInstance element)) => Collections.any(this, f); |
8016 | 8228 |
8017 bool get isEmpty => this.length == 0; | 8229 bool get isEmpty => this.length == 0; |
8018 | 8230 |
| 8231 List<ElementInstance> take(int n) => new ListView<ElementInstance>(this, 0, n)
; |
| 8232 |
| 8233 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) { |
| 8234 return new TakeWhileIterable<ElementInstance>(this, test); |
| 8235 } |
| 8236 |
| 8237 List<ElementInstance> skip(int n) => new ListView<ElementInstance>(this, n, nu
ll); |
| 8238 |
| 8239 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) { |
| 8240 return new SkipWhileIterable<ElementInstance>(this, test); |
| 8241 } |
| 8242 |
| 8243 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta
nce orElse() }) { |
| 8244 return Collections.firstMatching(this, test, orElse); |
| 8245 } |
| 8246 |
| 8247 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc
e orElse()}) { |
| 8248 return Collections.lastMatchingInList(this, test, orElse); |
| 8249 } |
| 8250 |
| 8251 ElementInstance singleMatching(bool test(ElementInstance value)) { |
| 8252 return Collections.singleMatching(this, test); |
| 8253 } |
| 8254 |
| 8255 ElementInstance elementAt(int index) { |
| 8256 return this[index]; |
| 8257 } |
| 8258 |
| 8259 // From Collection<ElementInstance>: |
| 8260 |
| 8261 void add(ElementInstance value) { |
| 8262 throw new UnsupportedError("Cannot add to immutable List."); |
| 8263 } |
| 8264 |
| 8265 void addLast(ElementInstance value) { |
| 8266 throw new UnsupportedError("Cannot add to immutable List."); |
| 8267 } |
| 8268 |
| 8269 void addAll(Iterable<ElementInstance> iterable) { |
| 8270 throw new UnsupportedError("Cannot add to immutable List."); |
| 8271 } |
| 8272 |
8019 // From List<ElementInstance>: | 8273 // From List<ElementInstance>: |
8020 void set length(int value) { | 8274 void set length(int value) { |
8021 throw new UnsupportedError("Cannot resize immutable List."); | 8275 throw new UnsupportedError("Cannot resize immutable List."); |
8022 } | 8276 } |
8023 | 8277 |
8024 void clear() { | 8278 void clear() { |
8025 throw new UnsupportedError("Cannot clear immutable List."); | 8279 throw new UnsupportedError("Cannot clear immutable List."); |
8026 } | 8280 } |
8027 | 8281 |
8028 void sort([int compare(ElementInstance a, ElementInstance b)]) { | 8282 void sort([int compare(ElementInstance a, ElementInstance b)]) { |
8029 throw new UnsupportedError("Cannot sort immutable List."); | 8283 throw new UnsupportedError("Cannot sort immutable List."); |
8030 } | 8284 } |
8031 | 8285 |
8032 int indexOf(ElementInstance element, [int start = 0]) => | 8286 int indexOf(ElementInstance element, [int start = 0]) => |
8033 Lists.indexOf(this, element, start, this.length); | 8287 Lists.indexOf(this, element, start, this.length); |
8034 | 8288 |
8035 int lastIndexOf(ElementInstance element, [int start]) { | 8289 int lastIndexOf(ElementInstance element, [int start]) { |
8036 if (start == null) start = length - 1; | 8290 if (start == null) start = length - 1; |
8037 return Lists.lastIndexOf(this, element, start); | 8291 return Lists.lastIndexOf(this, element, start); |
8038 } | 8292 } |
8039 | 8293 |
8040 ElementInstance get first => this[0]; | 8294 ElementInstance get first { |
| 8295 if (this.length > 0) return this[0]; |
| 8296 throw new StateError("No elements"); |
| 8297 } |
8041 | 8298 |
8042 ElementInstance get last => this[length - 1]; | 8299 ElementInstance get last { |
| 8300 if (this.length > 0) return this[this.length - 1]; |
| 8301 throw new StateError("No elements"); |
| 8302 } |
| 8303 |
| 8304 ElementInstance get single { |
| 8305 if (length == 1) return this[0]; |
| 8306 if (length == 0) throw new StateError("No elements"); |
| 8307 throw new StateError("More than one element"); |
| 8308 } |
| 8309 |
| 8310 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => _C
ollections.minInList(this, compare); |
| 8311 |
| 8312 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => _C
ollections.maxInList(this, compare); |
8043 | 8313 |
8044 ElementInstance removeAt(int pos) { | 8314 ElementInstance removeAt(int pos) { |
8045 throw new UnsupportedError("Cannot removeAt on immutable List."); | 8315 throw new UnsupportedError("Cannot removeAt on immutable List."); |
8046 } | 8316 } |
8047 | 8317 |
8048 ElementInstance removeLast() { | 8318 ElementInstance removeLast() { |
8049 throw new UnsupportedError("Cannot removeLast on immutable List."); | 8319 throw new UnsupportedError("Cannot removeLast on immutable List."); |
8050 } | 8320 } |
8051 | 8321 |
8052 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta
rtFrom]) { | 8322 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta
rtFrom]) { |
(...skipping 11 matching lines...) Expand all Loading... |
8064 List<ElementInstance> getRange(int start, int rangeLength) => | 8334 List<ElementInstance> getRange(int start, int rangeLength) => |
8065 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); | 8335 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); |
8066 | 8336 |
8067 // -- end List<ElementInstance> mixins. | 8337 // -- end List<ElementInstance> mixins. |
8068 | 8338 |
8069 | 8339 |
8070 /** @domName SVGElementInstanceList.item */ | 8340 /** @domName SVGElementInstanceList.item */ |
8071 ElementInstance item(int index) native "SVGElementInstanceList_item_Callback"; | 8341 ElementInstance item(int index) native "SVGElementInstanceList_item_Callback"; |
8072 | 8342 |
8073 } | 8343 } |
OLD | NEW |