View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.lookup;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.Collection;
21  import java.util.Iterator;
22  import java.util.List;
23  import java.util.ListIterator;
24  import java.util.RandomAccess;
25  
26  
27  public class CollectionIncomplete<T> implements List<T>, RandomAccess, Serializable {
28  
29      private static final long serialVersionUID = 8683452581122892189L;
30  	private final List<T> list;
31      private Long actualSizeIfTruncated;
32  
33  
34      /**
35       * @param collection
36       * @param actualSizeIfTruncated
37       */
38      public CollectionIncomplete(Collection<T> collection, Long actualSizeIfTruncated) {
39          super();
40          this.list = new ArrayList<T>(collection);
41          this.actualSizeIfTruncated = actualSizeIfTruncated;
42      }
43  
44      /**
45       * @param arg0
46       * @param arg1
47       */
48      public void add(int arg0, T arg1) {
49          list.add(arg0, arg1);
50      }
51  
52      /**
53       * @param arg0
54       * @return
55       */
56      public boolean add(T arg0) {
57          return list.add(arg0);
58      }
59  
60      /**
61       * @param arg0
62       * @param arg1
63       * @return
64       */
65      public boolean addAll(int arg0, Collection<? extends T> arg1) {
66          return list.addAll(arg0, arg1);
67      }
68  
69      /**
70       * @param arg0
71       * @return
72       */
73      public boolean addAll(Collection<? extends T> arg0) {
74          return list.addAll(arg0);
75      }
76  
77      /**
78       * 
79       */
80      public void clear() {
81          list.clear();
82      }
83  
84      /**
85       * @param arg0
86       * @return
87       */
88      public boolean contains(Object arg0) {
89          return list.contains(arg0);
90      }
91  
92      /**
93       * @param arg0
94       * @return
95       */
96      public boolean containsAll(Collection<?> arg0) {
97          return list.containsAll(arg0);
98      }
99  
100     /*
101      * (non-Javadoc)
102      * 
103      * @see java.lang.Object#equals(java.lang.Object)
104      */
105     public boolean equals(Object arg0) {
106         return list.equals(arg0);
107     }
108 
109     /**
110      * @param arg0
111      * @return
112      */
113     public T get(int arg0) {
114         return list.get(arg0);
115     }
116 
117     /*
118      * (non-Javadoc)
119      * 
120      * @see java.lang.Object#hashCode()
121      */
122     public int hashCode() {
123         return list.hashCode();
124     }
125 
126     /**
127      * @param arg0
128      * @return
129      */
130     public int indexOf(Object arg0) {
131         return list.indexOf(arg0);
132     }
133 
134     /**
135      * @return
136      */
137     public boolean isEmpty() {
138         return list.isEmpty();
139     }
140 
141     /**
142      * @return
143      */
144     public Iterator<T> iterator() {
145         return list.iterator();
146     }
147 
148     /**
149      * @param arg0
150      * @return
151      */
152     public int lastIndexOf(Object arg0) {
153         return list.lastIndexOf(arg0);
154     }
155 
156     /**
157      * @return
158      */
159     public ListIterator<T> listIterator() {
160         return list.listIterator();
161     }
162 
163     /**
164      * @param arg0
165      * @return
166      */
167     public ListIterator listIterator(int arg0) {
168         return list.listIterator(arg0);
169     }
170 
171     /**
172      * @param arg0
173      * @return
174      */
175     public T remove(int arg0) {
176         return list.remove(arg0);
177     }
178 
179     /**
180      * @param arg0
181      * @return
182      */
183     public boolean remove(Object arg0) {
184         return list.remove(arg0);
185     }
186 
187     /**
188      * @param arg0
189      * @return
190      */
191     public boolean removeAll(Collection<?> arg0) {
192         return list.removeAll(arg0);
193     }
194 
195     /**
196      * @param arg0
197      * @return
198      */
199     public boolean retainAll(Collection<?> arg0) {
200         return list.retainAll(arg0);
201     }
202 
203     /**
204      * @param arg0
205      * @param arg1
206      * @return
207      */
208     public T set(int arg0, T arg1) {
209         return list.set(arg0, arg1);
210     }
211 
212     /**
213      * @return
214      */
215     public int size() {
216         return list.size();
217     }
218 
219     /**
220      * @param arg0
221      * @param arg1
222      * @return
223      */
224     public List<T> subList(int arg0, int arg1) {
225         return list.subList(arg0, arg1);
226     }
227 
228     /**
229      * @return
230      */
231     public Object[] toArray() {
232         return list.toArray();
233     }
234 
235     /**
236      * @param arg0
237      * @return
238      */
239     public <T> T[] toArray(T[] arg0) {
240         return list.toArray(arg0);
241     }
242 
243     /*
244      * (non-Javadoc)
245      * 
246      * @see java.lang.Object#toString()
247      */
248     public String toString() {
249         return list.toString();
250     }
251 
252     /**
253      * @return Returns the actualSizeIfTruncated.
254      */
255     public Long getActualSizeIfTruncated() {
256         return actualSizeIfTruncated;
257     }
258 
259     /**
260      * @param actualSize The actualSizeIfTruncated to set.
261      */
262     public void setActualSizeIfTruncated(Long actualSizeIfTruncated) {
263         this.actualSizeIfTruncated = actualSizeIfTruncated;
264     }
265 }