Chromium Code Reviews| Index: pkg/barback/lib/src/asset_set.dart |
| diff --git a/pkg/barback/lib/src/asset_set.dart b/pkg/barback/lib/src/asset_set.dart |
| index f58e188cb2be5e5ff2f75b2a28dbf72e40e622c6..91f5c98fe7d54da8a1d2abb34b3c09b6572aa837 100644 |
| --- a/pkg/barback/lib/src/asset_set.dart |
| +++ b/pkg/barback/lib/src/asset_set.dart |
| @@ -18,6 +18,14 @@ import 'asset_id.dart'; |
| class AssetSet extends IterableBase<Asset> { |
| final _assets = new Map<AssetId, Asset>(); |
| + AssetSet(); |
| + |
| + AssetSet.from(Iterable<Asset> other) { |
|
Bob Nystrom
2013/07/30 22:25:02
Document, especially that later Assets take preced
nweiz
2013/07/30 22:46:21
Done.
|
| + for (var asset in other) { |
| + _assets[asset.id] = asset; |
| + } |
| + } |
| + |
| Iterator<Asset> get iterator => _assets.values.iterator; |
| int get length => _assets.length; |
| @@ -51,6 +59,8 @@ class AssetSet extends IterableBase<Asset> { |
| return _assets.containsKey(id); |
| } |
| + Asset removeId(AssetId id) => _assets.remove(id); |
|
Bob Nystrom
2013/07/30 22:25:02
Document.
nweiz
2013/07/30 22:46:21
Done.
|
| + |
| /// Removes all assets from the set. |
| void clear() { |
| _assets.clear(); |