OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of Money; | |
5 | 4 |
6 /** | 5 /** |
7 * Instances of the class [ComplexMoney] implement a monetary amount that is | 6 * Instances of the class [ComplexMoney] implement a monetary amount that is |
8 * composed from multiple currencies. | 7 * composed from multiple currencies. |
9 */ | 8 */ |
10 class ComplexMoney implements Money { | 9 class ComplexMoney implements Money { |
11 Queue<SimpleMoney> amounts; | 10 Queue<SimpleMoney> amounts; |
12 | 11 |
13 ComplexMoney(Queue<SimpleMoney> initialAmounts) { | 12 ComplexMoney(Queue<SimpleMoney> initialAmounts) { |
14 amounts = new Queue<SimpleMoney>(); | 13 amounts = new Queue<SimpleMoney>(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 61 |
63 bool contains(SimpleMoney money) { | 62 bool contains(SimpleMoney money) { |
64 for (SimpleMoney amount in amounts) { | 63 for (SimpleMoney amount in amounts) { |
65 if (amount == money) { | 64 if (amount == money) { |
66 return true; | 65 return true; |
67 } | 66 } |
68 } | 67 } |
69 return false; | 68 return false; |
70 } | 69 } |
71 } | 70 } |
OLD | NEW |