- public Enumeration keys() throws JSExn { return new CounterEnumeration(arr.length); }
- public Object get(Object key) throws JSExn { return wrap(arr[toInt(key)]); }
- public void put(Object key, Object val) throws JSExn { throw new JSExn("can't write to org.ibex.js.Reflection.Array's"); }
+ // FEATURE: Add a JSCounterEnumeration
+ public Enumeration keys() throws JSExn {
+ return new Enumeration(null) {
+ private int n = 0;
+ public boolean _hasMoreElements() { return n < arr.length; }
+ public JS _nextElement() {
+ return n >= arr.length ? null : JS.N(n++);
+ }
+ };
+ }
+ public JS get(JS key) throws JSExn { return wrap(arr[toInt(key)]); }
+ public void put(JS key, JS val) throws JSExn { throw new JSExn("can't write to org.ibex.js.Reflection.Array's"); }