OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library barback.transformer.aggregate_transform; | 5 library barback.transformer.aggregate_transform; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import '../asset/asset.dart'; | 10 import '../asset/asset.dart'; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 /// The controller for [AggregateTransform]. | 128 /// The controller for [AggregateTransform]. |
129 class AggregateTransformController extends BaseTransformController { | 129 class AggregateTransformController extends BaseTransformController { |
130 AggregateTransform get transform => super.transform; | 130 AggregateTransform get transform => super.transform; |
131 | 131 |
132 /// The set of assets that the transformer has emitted. | 132 /// The set of assets that the transformer has emitted. |
133 AssetSet get outputs => transform._outputs; | 133 AssetSet get outputs => transform._outputs; |
134 | 134 |
135 /// The controller for the [AggregateTransform.primaryInputs] stream. | 135 bool get isDone => transform._inputController.isClosed; |
136 StreamController<Asset> get inputController => transform._inputController; | |
137 | 136 |
138 AggregateTransformController(TransformNode node) | 137 AggregateTransformController(TransformNode node) |
139 : super(new AggregateTransform._(node)); | 138 : super(new AggregateTransform._(node)); |
140 | 139 |
141 void close() { | 140 /// Adds a primary input asset to the [AggregateTransform.primaryInputs] |
142 super.close(); | 141 /// stream. |
| 142 void addInput(Asset input) => transform._inputController.add(input); |
| 143 |
| 144 /// Returns whether an input with the given [id] was added via [addInput]. |
| 145 bool addedId(AssetId id) { |
| 146 return transform._emittedPrimaryInputs.ids.contains(id); |
| 147 } |
| 148 |
| 149 void done() { |
143 transform._inputController.close(); | 150 transform._inputController.close(); |
144 } | 151 } |
145 } | 152 } |
OLD | NEW |