|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| package edu.rice.cs.plt.collect; |
|
36 |
| |
|
37 |
| import java.util.Iterator; |
|
38 |
| import java.util.Collection; |
|
39 |
| import java.util.AbstractCollection; |
|
40 |
| import java.io.Serializable; |
|
41 |
| import edu.rice.cs.plt.iter.SizedIterable; |
|
42 |
| import edu.rice.cs.plt.iter.IterUtil; |
|
43 |
| import edu.rice.cs.plt.object.Composite; |
|
44 |
| import edu.rice.cs.plt.object.ObjectUtil; |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| public class DelegatingCollection<T> extends AbstractCollection<T> implements SizedIterable<T>, Composite, Serializable { |
|
57 |
| |
|
58 |
| protected Collection<T> _delegate; |
|
59 |
| |
|
60 |
203
| public DelegatingCollection(Collection<T> delegate) { _delegate = delegate; }
|
|
61 |
| |
|
62 |
0
| public int compositeHeight() { return ObjectUtil.compositeHeight(_delegate) + 1; }
|
|
63 |
0
| public int compositeSize() { return ObjectUtil.compositeSize(_delegate) + 1; }
|
|
64 |
| |
|
65 |
29
| public boolean isEmpty() { return _delegate.isEmpty(); }
|
|
66 |
45
| public int size() { return _delegate.size(); }
|
|
67 |
0
| public int size(int bound) { return IterUtil.sizeOf(_delegate, bound); }
|
|
68 |
0
| public boolean isInfinite() { return IterUtil.isInfinite(_delegate); }
|
|
69 |
0
| public boolean hasFixedSize() { return IterUtil.hasFixedSize(_delegate); }
|
|
70 |
0
| public boolean isStatic() { return IterUtil.isStatic(_delegate); }
|
|
71 |
| |
|
72 |
64
| public boolean contains(Object o) { return _delegate.contains(o); }
|
|
73 |
4
| public boolean containsAll(Collection<?> c) { return _delegate.containsAll(c); }
|
|
74 |
0
| public Iterator<T> iterator() { return _delegate.iterator(); }
|
|
75 |
0
| public Object[] toArray() { return _delegate.toArray(); }
|
|
76 |
0
| public <S> S[] toArray(S[] a) { return _delegate.toArray(a); }
|
|
77 |
| |
|
78 |
0
| public boolean add(T o) { return _delegate.add(o); }
|
|
79 |
0
| public boolean addAll(Collection<? extends T> c) { return _delegate.addAll(c); }
|
|
80 |
0
| public boolean remove(Object o) { return _delegate.remove(o); }
|
|
81 |
0
| public boolean retainAll(Collection<?> c) { return _delegate.retainAll(c); }
|
|
82 |
0
| public boolean removeAll(Collection<?> c) { return _delegate.removeAll(c); }
|
|
83 |
9
| public void clear() { _delegate.clear(); }
|
|
84 |
| |
|
85 |
6
| public String toString() { return _delegate.toString(); }
|
|
86 |
| |
|
87 |
0
| protected boolean abstractCollectionIsEmpty() { return super.isEmpty(); }
|
|
88 |
0
| protected boolean abstractCollectionContains(Object o) { return super.contains(o); }
|
|
89 |
0
| protected Object[] abstractCollectionToArray() { return super.toArray(); }
|
|
90 |
0
| protected <S> S[] abstractCollectionToArray(S[] a) { return super.toArray(a); }
|
|
91 |
0
| protected boolean abstractCollectionRemove(T o) { return super.remove(o); }
|
|
92 |
0
| protected boolean abstractCollectionContainsAll(Collection<?> c) { return super.containsAll(c); }
|
|
93 |
1
| protected boolean abstractCollectionAddAll(Collection<? extends T> c) { return super.addAll(c); }
|
|
94 |
0
| protected boolean abstractCollectionRetainAll(Collection<?> c) { return super.retainAll(c); }
|
|
95 |
2
| protected boolean abstractCollectionRemoveAll(Collection<?> c) { return super.removeAll(c); }
|
|
96 |
0
| protected void abstractCollectionClear() { super.clear(); }
|
|
97 |
| |
|
98 |
| } |