comparison dwtx/dwtxhelper/Collection.d @ 128:8df1d4193877

Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly. Add: collection impls.
author Frank Benoit <benoit@tionex.de>
date Sun, 17 Aug 2008 02:05:20 +0200
parents 1997315125c0
children 7926b636c282
comparison
equal deleted inserted replaced
127:1997315125c0 128:8df1d4193877
423 } 423 }
424 public this(Map t){ 424 public this(Map t){
425 implMissing( __FILE__, __LINE__ ); 425 implMissing( __FILE__, __LINE__ );
426 } 426 }
427 427
428 Enumeration elements(){ 428 class ObjectEnumeration : Enumeration {
429 implMissing( __FILE__, __LINE__ ); 429 Object[] values;
430 return null;
431 }
432 class KeysEnumeration : Enumeration {
433 Object[] keys;
434 int index = 0; 430 int index = 0;
435 this( Object[] keys ){ 431 this( Object[] values ){
436 this.keys = keys; 432 this.values = values;
437 } 433 }
438 public bool hasMoreElements(){ 434 public bool hasMoreElements(){
439 return index < keys.length; 435 return index < values.length;
440 } 436 }
441 public Object nextElement(){ 437 public Object nextElement(){
442 Object res = keys[index]; 438 Object res = values[index];
443 index++; 439 index++;
444 return res; 440 return res;
445 } 441 }
446 } 442 }
447 443
444 Enumeration elements(){
445 return new ObjectEnumeration( map.values );
446 }
448 Enumeration keys() { 447 Enumeration keys() {
449 return new KeysEnumeration( map.keys ); 448 return new ObjectEnumeration( map.keys );
450 } 449 }
451 public synchronized void clear(){ 450 public synchronized void clear(){
452 map = null; 451 map = null;
453 } 452 }
454 public synchronized bool containsKey(Object key){ 453 public synchronized bool containsKey(Object key){
511 implMissing( __FILE__, __LINE__ ); 510 implMissing( __FILE__, __LINE__ );
512 return null; 511 return null;
513 } 512 }
514 // public Object remove(String key) 513 // public Object remove(String key)
515 public synchronized int size(){ 514 public synchronized int size(){
516 implMissing( __FILE__, __LINE__ ); 515 return map.length;
517 return 0;
518 } 516 }
519 public Collection values(){ 517 public Collection values(){
520 implMissing( __FILE__, __LINE__ ); 518 implMissing( __FILE__, __LINE__ );
521 return null; 519 return null;
522 } 520 }