| OLD | NEW |
| 1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 part of quiver.collection; | 15 part of quiver.collection; |
| 16 | 16 |
| 17 /** | 17 /// An implementation of [Set] that delegates all methods to another [Set]. |
| 18 * An implementation of [Set] that delegates all methods to another [Set]. | 18 /// For instance you can create a FruitSet like this : |
| 19 * For instance you can create a FruitSet like this : | 19 /// |
| 20 * | 20 /// class FruitSet extends DelegatingSet<Fruit> { |
| 21 * class FruitSet extends DelegatingSet<Fruit> { | 21 /// final Set<Fruit> _fruits = new Set<Fruit>(); |
| 22 * final Set<Fruit> _fruits = new Set<Fruit>(); | 22 /// |
| 23 * | 23 /// Set<Fruit> get delegate => _fruits; |
| 24 * Set<Fruit> get delegate => _fruits; | 24 /// |
| 25 * | 25 /// // custom methods |
| 26 * // custom methods | 26 /// } |
| 27 * } | |
| 28 */ | |
| 29 abstract class DelegatingSet<E> extends DelegatingIterable<E> | 27 abstract class DelegatingSet<E> extends DelegatingIterable<E> |
| 30 implements Set<E> { | 28 implements Set<E> { |
| 31 Set<E> get delegate; | 29 Set<E> get delegate; |
| 32 | 30 |
| 33 bool add(E value) => delegate.add(value); | 31 bool add(E value) => delegate.add(value); |
| 34 | 32 |
| 35 void addAll(Iterable<E> elements) => delegate.addAll(elements); | 33 void addAll(Iterable<E> elements) => delegate.addAll(elements); |
| 36 | 34 |
| 37 void clear() => delegate.clear(); | 35 void clear() => delegate.clear(); |
| 38 | 36 |
| 39 bool containsAll(Iterable<Object> other) => delegate.containsAll(other); | 37 bool containsAll(Iterable<Object> other) => delegate.containsAll(other); |
| 40 | 38 |
| 41 Set<E> difference(Set<E> other) => delegate.difference(other); | 39 Set<E> difference(Set<Object> other) => delegate.difference(other); |
| 42 | 40 |
| 43 Set<E> intersection(Set<Object> other) => delegate.intersection(other); | 41 Set<E> intersection(Set<Object> other) => delegate.intersection(other); |
| 44 | 42 |
| 45 E lookup(Object object) => delegate.lookup(object); | 43 E lookup(Object object) => delegate.lookup(object); |
| 46 | 44 |
| 47 bool remove(Object value) => delegate.remove(value); | 45 bool remove(Object value) => delegate.remove(value); |
| 48 | 46 |
| 49 void removeAll(Iterable<Object> elements) => delegate.removeAll(elements); | 47 void removeAll(Iterable<Object> elements) => delegate.removeAll(elements); |
| 50 | 48 |
| 51 void removeWhere(bool test(E element)) => delegate.removeWhere(test); | 49 void removeWhere(bool test(E element)) => delegate.removeWhere(test); |
| 52 | 50 |
| 53 void retainAll(Iterable<Object> elements) => delegate.retainAll(elements); | 51 void retainAll(Iterable<Object> elements) => delegate.retainAll(elements); |
| 54 | 52 |
| 55 void retainWhere(bool test(E element)) => delegate.retainWhere(test); | 53 void retainWhere(bool test(E element)) => delegate.retainWhere(test); |
| 56 | 54 |
| 57 Set<E> union(Set<E> other) => delegate.union(other); | 55 Set<E> union(Set<E> other) => delegate.union(other); |
| 58 } | 56 } |
| OLD | NEW |