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

Side by Side Diff: lib/src/stream_splitter.dart

Issue 2660333005: Change generic comment syntax to real generic syntax. (Closed)
Patch Set: Update version. Created 3 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
« no previous file with comments | « lib/src/stream_sink_transformer.dart ('k') | lib/src/stream_subscription_transformer.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'future_group.dart'; 7 import 'future_group.dart';
8 import 'result.dart'; 8 import 'result.dart';
9 9
10 /// A class that splits a single source stream into an arbitrary number of 10 /// A class that splits a single source stream into an arbitrary number of
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 /// Whether [_stream] is done emitting events. 50 /// Whether [_stream] is done emitting events.
51 var _isDone = false; 51 var _isDone = false;
52 52
53 /// Whether [close] has been called. 53 /// Whether [close] has been called.
54 var _isClosed = false; 54 var _isClosed = false;
55 55
56 /// Splits [stream] into [count] identical streams. 56 /// Splits [stream] into [count] identical streams.
57 /// 57 ///
58 /// [count] defaults to 2. This is the same as creating [count] branches and 58 /// [count] defaults to 2. This is the same as creating [count] branches and
59 /// then closing the [StreamSplitter]. 59 /// then closing the [StreamSplitter].
60 static List<Stream/*<T>*/> splitFrom/*<T>*/(Stream/*<T>*/ stream, 60 static List<Stream<T>> splitFrom<T>(Stream<T> stream,
61 [int count]) { 61 [int count]) {
62 if (count == null) count = 2; 62 if (count == null) count = 2;
63 var splitter = new StreamSplitter/*<T>*/(stream); 63 var splitter = new StreamSplitter<T>(stream);
64 var streams = new List<Stream>.generate(count, (_) => splitter.split()); 64 var streams = new List<Stream>.generate(count, (_) => splitter.split());
65 splitter.close(); 65 splitter.close();
66 return streams; 66 return streams;
67 } 67 }
68 68
69 StreamSplitter(this._stream); 69 StreamSplitter(this._stream);
70 70
71 /// Returns a single-subscription stream that's a copy of the input stream. 71 /// Returns a single-subscription stream that's a copy of the input stream.
72 /// 72 ///
73 /// This will throw a [StateError] if [close] has been called. 73 /// This will throw a [StateError] if [close] has been called.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 /// Marks [_controllers] as done. 203 /// Marks [_controllers] as done.
204 void _onDone() { 204 void _onDone() {
205 _isDone = true; 205 _isDone = true;
206 for (var controller in _controllers) { 206 for (var controller in _controllers) {
207 _closeGroup.add(controller.close()); 207 _closeGroup.add(controller.close());
208 } 208 }
209 } 209 }
210 } 210 }
OLDNEW
« no previous file with comments | « lib/src/stream_sink_transformer.dart ('k') | lib/src/stream_subscription_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698