move JS's Hashtable to JS.O
[org.ibex.core.git] / src / org / ibex / js / JSArray.java
index bf54947..168bab3 100644 (file)
@@ -5,7 +5,7 @@ import org.ibex.util.*;
 import java.util.*;
 
 /** A JavaScript JSArray */
-public class JSArray extends JS {
+public class JSArray extends JS.BT {
     private static final Object NULL = new Object();
     
     public JSArray() { }
@@ -99,11 +99,11 @@ public class JSArray extends JS {
 
     public Enumeration keys() {
         return new Enumeration() {
-                private int cur = 0;
-                public boolean hasMoreElements() { return cur < size(); }
+                private int n = size();
+                public boolean hasMoreElements() { return n > 0; }
                 public Object nextElement() {
-                    if (cur >= size()) throw new NoSuchElementException();
-                    return new Integer(cur++);
+                    if(n == 0) throw new NoSuchElementException();
+                    return new Integer(--n);
                 }
             };
     }