1 package org.jgroups.util; 2 3 import java.util.*; 4 5 10 public class UnmodifiableVector extends Vector { 11 Vector v; 12 13 public UnmodifiableVector(Vector v) { 14 this.v=v; 15 } 16 17 public synchronized void copyInto(Object [] anArray) { 18 v.copyInto(anArray); 19 } 20 21 public synchronized void trimToSize() { 22 throw new UnsupportedOperationException (); 23 } 24 25 public synchronized void ensureCapacity(int minCapacity) { 26 throw new UnsupportedOperationException (); 27 } 28 29 public synchronized void setSize(int newSize) { 30 throw new UnsupportedOperationException (); 31 } 32 33 public synchronized int capacity() { 34 return v.capacity(); 35 } 36 37 public synchronized int size() { 38 return v.size(); 39 } 40 41 public synchronized boolean isEmpty() { 42 return v.isEmpty(); 43 } 44 45 public Enumeration elements() { 46 return v.elements(); 47 } 48 49 public boolean contains(Object elem) { 50 return v.contains(elem); 51 } 52 53 public int indexOf(Object elem) { 54 return v.indexOf(elem); 55 } 56 57 public synchronized int indexOf(Object elem, int index) { 58 return v.indexOf(elem, index); 59 } 60 61 public synchronized int lastIndexOf(Object elem) { 62 return v.lastIndexOf(elem); 63 } 64 65 public synchronized int lastIndexOf(Object elem, int index) { 66 return v.lastIndexOf(elem, index); 67 } 68 69 public synchronized Object elementAt(int index) { 70 return v.elementAt(index); 71 } 72 73 public synchronized Object firstElement() { 74 return v.firstElement(); 75 } 76 77 public synchronized Object lastElement() { 78 return v.lastElement(); 79 } 80 81 public synchronized void setElementAt(Object obj, int index) { 82 v.setElementAt(obj, index); 83 } 84 85 public synchronized void removeElementAt(int index) { 86 throw new UnsupportedOperationException (); 87 } 88 89 public synchronized void insertElementAt(Object obj, int index) { 90 throw new UnsupportedOperationException (); 91 } 92 93 public synchronized void addElement(Object obj) { 94 throw new UnsupportedOperationException (); 95 } 96 97 public synchronized boolean removeElement(Object obj) { 98 throw new UnsupportedOperationException (); 99 } 100 101 public synchronized void removeAllElements() { 102 throw new UnsupportedOperationException (); 103 } 104 105 public synchronized Object clone() { 106 return v.clone(); 107 } 108 109 public synchronized Object [] toArray() { 110 return v.toArray(); 111 } 112 113 public synchronized Object [] toArray(Object [] a) { 114 return v.toArray(a); 115 } 116 117 public synchronized Object get(int index) { 118 return v.get(index); 119 } 120 121 public synchronized Object set(int index, Object element) { 122 throw new UnsupportedOperationException (); 123 } 124 125 public synchronized boolean add(Object o) { 126 throw new UnsupportedOperationException (); 127 } 128 129 public boolean remove(Object o) { 130 throw new UnsupportedOperationException (); 131 } 132 133 public void add(int index, Object element) { 134 throw new UnsupportedOperationException (); 135 } 136 137 public synchronized Object remove(int index) { 138 throw new UnsupportedOperationException (); 139 } 140 141 public void clear() { 142 throw new UnsupportedOperationException (); 143 } 144 145 public synchronized boolean containsAll(Collection c) { 146 return v.containsAll(c); 147 } 148 149 public synchronized boolean addAll(Collection c) { 150 throw new UnsupportedOperationException (); 151 } 152 153 public synchronized boolean removeAll(Collection c) { 154 throw new UnsupportedOperationException (); 155 } 156 157 public synchronized boolean retainAll(Collection c) { 158 throw new UnsupportedOperationException (); 159 } 160 161 public synchronized boolean addAll(int index, Collection c) { 162 throw new UnsupportedOperationException (); 163 } 164 165 public synchronized boolean equals(Object o) { 166 return v.equals(o); 167 } 168 169 public synchronized int hashCode() { 170 return v.hashCode(); 171 } 172 173 public synchronized String toString() { 174 return v.toString(); 175 } 176 177 public synchronized java.util.List subList(int fromIndex, int toIndex) { 178 return v.subList(fromIndex, toIndex); 179 } 180 181 public ListIterator listIterator() { 182 return new ListIterator() { 183 ListIterator i = v.listIterator(); 184 185 public boolean hasNext() {return i.hasNext();} 186 public Object next() {return i.next();} 187 188 public boolean hasPrevious() { 189 return i.hasPrevious(); 190 } 191 192 public Object previous() { 193 return i.previous(); 194 } 195 196 public int nextIndex() { 197 return i.nextIndex(); 198 } 199 200 public int previousIndex() { 201 return i.previousIndex(); 202 } 203 204 public void remove() { 205 throw new UnsupportedOperationException (); 206 } 207 208 public void set(Object o) { 209 throw new UnsupportedOperationException (); 210 } 211 212 public void add(Object o) { 213 throw new UnsupportedOperationException (); 214 } 215 }; 216 } 217 218 public ListIterator listIterator(final int index) { 219 return new ListIterator() { 220 ListIterator i = v.listIterator(index); 221 222 public boolean hasNext() {return i.hasNext();} 223 public Object next() {return i.next();} 224 225 public boolean hasPrevious() { 226 return i.hasPrevious(); 227 } 228 229 public Object previous() { 230 return i.previous(); 231 } 232 233 public int nextIndex() { 234 return i.nextIndex(); 235 } 236 237 public int previousIndex() { 238 return i.previousIndex(); 239 } 240 241 public void remove() { 242 throw new UnsupportedOperationException (); 243 } 244 245 public void set(Object o) { 246 throw new UnsupportedOperationException (); 247 } 248 249 public void add(Object o) { 250 throw new UnsupportedOperationException (); 251 } 252 }; 253 } 254 255 256 public Iterator iterator() { 257 return new Iterator() { 258 Iterator i = v.iterator(); 259 260 public boolean hasNext() {return i.hasNext();} 261 public Object next() {return i.next();} 262 public void remove() { 263 throw new UnsupportedOperationException (); 264 } 265 }; 266 } 267 } 268 | Popular Tags |