comparison dwtx/dwtxhelper/Collection.d @ 179:9008cb2f47c5

Fix tango.core.Array.remove use
author Frank Benoit <benoit@tionex.de>
date Fri, 19 Sep 2008 22:37:04 +0200
parents 21c77bcb7887
children 41471f9968be
comparison
equal deleted inserted replaced
178:1470d66733fa 179:9008cb2f47c5
2182 str[] = c; 2182 str[] = c;
2183 } 2183 }
2184 } 2184 }
2185 2185
2186 class Collections { 2186 class Collections {
2187 private static void unsupported(){
2188 throw new UnsupportedOperationException();
2189 }
2187 2190
2188 private static List EMPTY_LIST_; 2191 private static List EMPTY_LIST_;
2189 public static List EMPTY_LIST(){ 2192 public static List EMPTY_LIST(){
2190 if( EMPTY_LIST_ is null ){ 2193 if( EMPTY_LIST_ is null ){
2191 synchronized(Collections.classinfo ){ 2194 synchronized(Collections.classinfo ){
2216 } 2219 }
2217 } 2220 }
2218 } 2221 }
2219 return EMPTY_SET_; 2222 return EMPTY_SET_;
2220 } 2223 }
2224 static class UnmodifiableIterator : Iterator {
2225 Iterator it;
2226 this(Iterator it){
2227 this.it = it;
2228 }
2229 public bool hasNext(){
2230 return it.hasNext();
2231 }
2232 public Object next(){
2233 return it.next();
2234 }
2235 public void remove(){
2236 unsupported();
2237 }
2238 }
2239 static class UnmodifiableListIterator : ListIterator {
2240 ListIterator it;
2241 this(ListIterator it){
2242 this.it = it;
2243 }
2244 public void add(Object o){
2245 unsupported();
2246 }
2247 public bool add(String o){
2248 unsupported();
2249 return false; // make compiler happy
2250 }
2251 public bool hasNext(){
2252 return it.hasNext();
2253 }
2254 public bool hasPrevious(){
2255 return it.hasPrevious();
2256 }
2257 public Object next(){
2258 return it.next();
2259 }
2260 public int nextIndex(){
2261 return it.nextIndex();
2262 }
2263 public Object previous(){
2264 return it.previous();
2265 }
2266 public int previousIndex(){
2267 return it.previousIndex();
2268 }
2269 public void remove(){
2270 unsupported();
2271 }
2272 public void set(Object o){
2273 unsupported();
2274 }
2275 }
2276 static class UnmodifieableList : List {
2277 List list;
2278 this(List list){
2279 this.list = list;
2280 }
2281 public void add(int index, Object element){
2282 unsupported();
2283 }
2284 public bool add(Object o){
2285 unsupported();
2286 return false; // make compiler happy
2287 }
2288 public bool add(String o){
2289 unsupported();
2290 return false; // make compiler happy
2291 }
2292 public bool addAll(Collection c){
2293 unsupported();
2294 return false; // make compiler happy
2295 }
2296 public bool addAll(int index, Collection c){
2297 unsupported();
2298 return false; // make compiler happy
2299 }
2300 public void clear(){
2301 unsupported();
2302 return false; // make compiler happy
2303 }
2304 public bool contains(Object o){
2305 return list.contains(o);
2306 }
2307 public bool contains(String o){
2308 return list.contains(o);
2309 }
2310 public bool containsAll(Collection c){
2311 return list.containsAll(c);
2312 }
2313 public int opEquals(Object o){
2314 return list.opEquals(o);
2315 }
2316 public Object get(int index){
2317 return list.get(index);
2318 }
2319 public hash_t toHash(){
2320 return list.toHash();
2321 }
2322 public int indexOf(Object o){
2323 return list.indexOf(o);
2324 }
2325 public bool isEmpty(){
2326 return list.isEmpty();
2327 }
2328 public Iterator iterator(){
2329 return new UnmodifiableIterator( list.iterator() );
2330 }
2331 public int lastIndexOf(Object o){
2332 return list.lastIndexOf(o);
2333 }
2334 public ListIterator listIterator(){
2335 return new UnmodifiableListIterator( list.listIterator() );
2336 }
2337 public ListIterator listIterator(int index){
2338 return new UnmodifiableListIterator( list.listIterator(index) );
2339 }
2340 public Object remove(int index){
2341 unsupported();
2342 return null; // make compiler happy
2343 }
2344 public bool remove(Object o){
2345 unsupported();
2346 return false; // make compiler happy
2347 }
2348 public bool remove(String o){
2349 unsupported();
2350 return false; // make compiler happy
2351 }
2352 public bool removeAll(Collection c){
2353 unsupported();
2354 return false; // make compiler happy
2355 }
2356 public bool retainAll(Collection c){
2357 unsupported();
2358 return false; // make compiler happy
2359 }
2360 public Object set(int index, Object element){
2361 unsupported();
2362 return null; // make compiler happy
2363 }
2364 public int size(){
2365 return list.size();
2366 }
2367 public List subList(int fromIndex, int toIndex){
2368 return new UnmodifieableList( list.subList(fromIndex,toIndex));
2369 }
2370 public Object[] toArray(){
2371 return list.toArray();
2372 }
2373 public Object[] toArray(Object[] a){
2374 return list.toArray(a);
2375 }
2376 public int opApply (int delegate(ref Object value) dg){
2377 implMissing(__FILE__, __LINE__ );
2378 return 0;
2379 }
2380 public int opApply (int delegate(ref Object key, ref Object value) dg){
2381 implMissing(__FILE__, __LINE__ );
2382 return 0;
2383 }
2384 }
2221 static int binarySearch(List list, Object key){ 2385 static int binarySearch(List list, Object key){
2222 implMissing( __FILE__, __LINE__ ); 2386 implMissing( __FILE__, __LINE__ );
2223 return 0; 2387 return 0;
2224 } 2388 }
2225 static int binarySearch(List list, Object key, Comparator c){ 2389 static int binarySearch(List list, Object key, Comparator c){
2226 implMissing( __FILE__, __LINE__ ); 2390 implMissing( __FILE__, __LINE__ );
2227 return 0; 2391 return 0;
2228 } 2392 }
2229 public static List unmodifiableList( List list ){ 2393 public static List unmodifiableList( List list ){
2230 implMissing( __FILE__, __LINE__ ); 2394 return new UnmodifieableList(list);
2231 return null;
2232 } 2395 }
2233 public static Map unmodifiableMap( Map list ){ 2396 public static Map unmodifiableMap( Map list ){
2234 implMissing( __FILE__, __LINE__ ); 2397 implMissing( __FILE__, __LINE__ );
2235 return null; 2398 return null;
2236 } 2399 }