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 [Queue] that delegates all methods to another [Queue]. |
18 * An implementation of [Queue] that delegates all methods to another [Queue]. | 18 /// For instance you can create a FruitQueue like this : |
19 * For instance you can create a FruitQueue like this : | 19 /// |
20 * | 20 /// class FruitQueue extends DelegatingQueue<Fruit> { |
21 * class FruitQueue extends DelegatingQueue<Fruit> { | 21 /// final Queue<Fruit> _fruits = new Queue<Fruit>(); |
22 * final Queue<Fruit> _fruits = new Queue<Fruit>(); | 22 /// |
23 * | 23 /// Queue<Fruit> get delegate => _fruits; |
24 * Queue<Fruit> get delegate => _fruits; | 24 /// |
25 * | 25 /// // custom methods |
26 * // custom methods | 26 /// } |
27 * } | |
28 */ | |
29 abstract class DelegatingQueue<E> extends DelegatingIterable<E> | 27 abstract class DelegatingQueue<E> extends DelegatingIterable<E> |
30 implements Queue<E> { | 28 implements Queue<E> { |
31 Queue<E> get delegate; | 29 Queue<E> get delegate; |
32 | 30 |
33 void add(E value) => delegate.add(value); | 31 void add(E value) => delegate.add(value); |
34 | 32 |
35 void addAll(Iterable<E> iterable) => delegate.addAll(iterable); | 33 void addAll(Iterable<E> iterable) => delegate.addAll(iterable); |
36 | 34 |
37 void addFirst(E value) => delegate.addFirst(value); | 35 void addFirst(E value) => delegate.addFirst(value); |
38 | 36 |
39 void addLast(E value) => delegate.addLast(value); | 37 void addLast(E value) => delegate.addLast(value); |
40 | 38 |
41 void clear() => delegate.clear(); | 39 void clear() => delegate.clear(); |
42 | 40 |
43 bool remove(Object object) => delegate.remove(object); | 41 bool remove(Object object) => delegate.remove(object); |
44 | 42 |
45 E removeFirst() => delegate.removeFirst(); | 43 E removeFirst() => delegate.removeFirst(); |
46 | 44 |
47 E removeLast() => delegate.removeLast(); | 45 E removeLast() => delegate.removeLast(); |
48 | 46 |
49 void removeWhere(bool test(E element)) => delegate.removeWhere(test); | 47 void removeWhere(bool test(E element)) => delegate.removeWhere(test); |
50 | 48 |
51 void retainWhere(bool test(E element)) => delegate.retainWhere(test); | 49 void retainWhere(bool test(E element)) => delegate.retainWhere(test); |
52 } | 50 } |
OLD | NEW |