View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.collections.primitives.decorators;
18  
19  import org.apache.commons.collections.primitives.IntCollection;
20  import org.apache.commons.collections.primitives.IntIterator;
21  
22  /**
23   * 
24   * @since Commons Primitives 1.0
25   * @version $Revision: 480463 $ $Date: 2006-11-29 03:15:23 -0500 (Wed, 29 Nov 2006) $
26   * 
27   * @author Rodney Waldhoff 
28   */
29  abstract class BaseProxyIntCollection implements IntCollection {
30      protected abstract IntCollection getProxiedCollection();
31  
32      protected BaseProxyIntCollection() {
33      }
34      
35  
36      
37      public boolean add(int element) {
38          return getProxiedCollection().add(element);
39      }
40  
41      public boolean addAll(IntCollection c) {
42          return getProxiedCollection().addAll(c);
43      }
44  
45      public void clear() {
46          getProxiedCollection().clear();
47      }
48  
49      public boolean contains(int element) {
50          return getProxiedCollection().contains(element);
51      }
52  
53      public boolean containsAll(IntCollection c) {
54          return getProxiedCollection().containsAll(c);
55      }
56  
57      public boolean isEmpty() {
58          return getProxiedCollection().isEmpty();
59      }
60  
61      public IntIterator iterator() {
62          return getProxiedCollection().iterator();
63      }
64  
65      public boolean removeAll(IntCollection c) {
66          return getProxiedCollection().removeAll(c);
67      }
68  
69      public boolean removeElement(int element) {
70          return getProxiedCollection().removeElement(element);
71      }
72  
73      public boolean retainAll(IntCollection c) {
74          return getProxiedCollection().retainAll(c);
75      }
76  
77      public int size() {
78          return getProxiedCollection().size();
79      }
80  
81      public int[] toArray() {
82          return getProxiedCollection().toArray();
83      }
84  
85      public int[] toArray(int[] a) {
86          return getProxiedCollection().toArray(a);
87      }
88  
89      // TODO: Add note about possible contract violations here.
90      
91      public boolean equals(Object obj) {
92          return getProxiedCollection().equals(obj);
93      }
94  
95      public int hashCode() {
96          return getProxiedCollection().hashCode();
97      }
98  
99      public String toString() {
100         return getProxiedCollection().toString();
101     }
102 
103 }