Mercurial > projects > dwt-addons
diff 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 |
line wrap: on
line diff
--- a/dwtx/dwtxhelper/Collection.d Sun Aug 17 01:30:26 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Sun Aug 17 02:05:20 2008 +0200 @@ -425,28 +425,27 @@ implMissing( __FILE__, __LINE__ ); } - Enumeration elements(){ - implMissing( __FILE__, __LINE__ ); - return null; - } - class KeysEnumeration : Enumeration { - Object[] keys; + class ObjectEnumeration : Enumeration { + Object[] values; int index = 0; - this( Object[] keys ){ - this.keys = keys; + this( Object[] values ){ + this.values = values; } public bool hasMoreElements(){ - return index < keys.length; + return index < values.length; } public Object nextElement(){ - Object res = keys[index]; + Object res = values[index]; index++; return res; } } + Enumeration elements(){ + return new ObjectEnumeration( map.values ); + } Enumeration keys() { - return new KeysEnumeration( map.keys ); + return new ObjectEnumeration( map.keys ); } public synchronized void clear(){ map = null; @@ -513,8 +512,7 @@ } // public Object remove(String key) public synchronized int size(){ - implMissing( __FILE__, __LINE__ ); - return 0; + return map.length; } public Collection values(){ implMissing( __FILE__, __LINE__ );