# HG changeset patch # User Frank Benoit # Date 1222010288 -7200 # Node ID 41471f9968be7bcb03d690fee32a0811345a451d # Parent 9008cb2f47c5f81e991cf79505839f1ad5dfe212 Collection impl diff -r 9008cb2f47c5 -r 41471f9968be dwtx/dwtxhelper/Collection.d --- a/dwtx/dwtxhelper/Collection.d Fri Sep 19 22:37:04 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Sun Sep 21 17:18:08 2008 +0200 @@ -975,8 +975,14 @@ return set.size(); } public Object[] toArray(){ - implMissing( __FILE__, __LINE__ ); - return null; + Object[] res; + res.length = size(); + int idx = 0; + foreach( o; set ){ + res[idx] = o; + idx++; + } + return res; } public Object[] toArray(Object[] a){ implMissing( __FILE__, __LINE__ ); @@ -2443,9 +2449,22 @@ list.set( data.length -1 -idx, data[idx] ); } } + static class LocalEnumeration : Enumeration { + Object[] data; + this( Object[] data ){ + this.data = data; + } + public bool hasMoreElements(){ + return data.length > 0; + } + public Object nextElement(){ + Object res = data[0]; + data = data[ 1 .. $ ]; + return res; + } + } static Enumeration enumeration(Collection c){ - implMissing( __FILE__, __LINE__ ); - return null; + return new LocalEnumeration( c.toArray() ); } }