better enumeration, no need for SWAP(n>1)
[org.ibex.core.git] / src / org / ibex / js / Directory.java
index bad28fa..98469d5 100644 (file)
@@ -75,9 +75,9 @@ public class Directory extends JS {
                 out.close();
             } else {
                 Directory d2 = new Directory(f2);
-                Enumeration e = ((JS)val).keys();
+                JS.Enumeration e = val.keys();
                 while(e.hasMoreElements()) {
-                    JS k = (JS)e.nextElement();
+                    JS k = e.nextElement();
                     JS v = val.get(k);
                     d2.put(k, v);
                 }
@@ -109,10 +109,10 @@ public class Directory extends JS {
 
     public Enumeration keys() {
         final String[] elements = f.list();
-        return new Enumeration() {
+        return new Enumeration(null) {
                 int i = 0;
-                public boolean hasMoreElements() { return i < elements.length; }
-                public Object nextElement() { return FileNameEncoder.decode(elements[i++]); }
+                public boolean _hasMoreElements() { return i < elements.length; }
+                public JS _nextElement() { return JS.S(FileNameEncoder.decode(elements[i++])); }
             };
     }
 }