| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
| 8 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 * the returned stream is listened to. | 899 * the returned stream is listened to. |
| 900 */ | 900 */ |
| 901 Stream<T> skipWhile(bool test(T element)) { | 901 Stream<T> skipWhile(bool test(T element)) { |
| 902 return new _SkipWhileStream<T>(this, test); | 902 return new _SkipWhileStream<T>(this, test); |
| 903 } | 903 } |
| 904 | 904 |
| 905 /** | 905 /** |
| 906 * Skips data events if they are equal to the previous data event. | 906 * Skips data events if they are equal to the previous data event. |
| 907 * | 907 * |
| 908 * The returned stream provides the same events as this stream, except | 908 * The returned stream provides the same events as this stream, except |
| 909 * that it never provides two consequtive data events that are equal. | 909 * that it never provides two consecutive data events that are equal. |
| 910 * | 910 * |
| 911 * Equality is determined by the provided [equals] method. If that is | 911 * Equality is determined by the provided [equals] method. If that is |
| 912 * omitted, the '==' operator on the last provided data element is used. | 912 * omitted, the '==' operator on the last provided data element is used. |
| 913 * | 913 * |
| 914 * The returned stream is a broadcast stream if this stream is. | 914 * The returned stream is a broadcast stream if this stream is. |
| 915 * If a broadcast stream is listened to more than once, each subscription | 915 * If a broadcast stream is listened to more than once, each subscription |
| 916 * will individually perform the `equals` test. | 916 * will individually perform the `equals` test. |
| 917 */ | 917 */ |
| 918 Stream<T> distinct([bool equals(T previous, T next)]) { | 918 Stream<T> distinct([bool equals(T previous, T next)]) { |
| 919 return new _DistinctStream<T>(this, equals); | 919 return new _DistinctStream<T>(this, equals); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 bool cancelOnError }) { | 1452 bool cancelOnError }) { |
| 1453 return _stream.listen(onData, onError: onError, onDone: onDone, | 1453 return _stream.listen(onData, onError: onError, onDone: onDone, |
| 1454 cancelOnError: cancelOnError); | 1454 cancelOnError: cancelOnError); |
| 1455 } | 1455 } |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 | 1458 |
| 1459 /** | 1459 /** |
| 1460 * Abstract interface for a "sink" accepting multiple entire streams. | 1460 * Abstract interface for a "sink" accepting multiple entire streams. |
| 1461 * | 1461 * |
| 1462 * A consumer can accept a number of consequtive streams using [addStream], | 1462 * A consumer can accept a number of consecutive streams using [addStream], |
| 1463 * and when no further data need to be added, the [close] method tells the | 1463 * and when no further data need to be added, the [close] method tells the |
| 1464 * consumer to complete its work and shut down. | 1464 * consumer to complete its work and shut down. |
| 1465 * | 1465 * |
| 1466 * This class is not just a [Sink<Stream>] because it is also combined with | 1466 * This class is not just a [Sink<Stream>] because it is also combined with |
| 1467 * other [Sink] classes, like it's combined with [EventSink] in the | 1467 * other [Sink] classes, like it's combined with [EventSink] in the |
| 1468 * [StreamSink] class. | 1468 * [StreamSink] class. |
| 1469 * | 1469 * |
| 1470 * The [Stream.pipe] accepts a `StreamConsumer` and will pass the stream | 1470 * The [Stream.pipe] accepts a `StreamConsumer` and will pass the stream |
| 1471 * to the consumer's [addStream] method. When that completes, it will | 1471 * to the consumer's [addStream] method. When that completes, it will |
| 1472 * call [close] and then complete its own returned future. | 1472 * call [close] and then complete its own returned future. |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1743 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
| 1744 EventSink _sink; | 1744 EventSink _sink; |
| 1745 _ControllerEventSinkWrapper(this._sink); | 1745 _ControllerEventSinkWrapper(this._sink); |
| 1746 | 1746 |
| 1747 void add(T data) { _sink.add(data); } | 1747 void add(T data) { _sink.add(data); } |
| 1748 void addError(error, [StackTrace stackTrace]) { | 1748 void addError(error, [StackTrace stackTrace]) { |
| 1749 _sink.addError(error, stackTrace); | 1749 _sink.addError(error, stackTrace); |
| 1750 } | 1750 } |
| 1751 void close() { _sink.close(); } | 1751 void close() { _sink.close(); } |
| 1752 } | 1752 } |
| OLD | NEW |