-
- JS _unclone() { return this; }
- public static class Cloneable extends JS {
- public Object jsclone() throws JSExn {
- return new Clone(this);
+
+ public final boolean equals(Object o) { return this == o || ((o instanceof JS) && jsequals((JS)o)); }
+
+ // FIXME: Remove this, eventually
+ public final String toString() { throw new Error("you shouldn't use toString() on JS objects"); }
+
+ // These are only used internally by org.ibex.js
+ Trap getTrap(JS key) { return null; }
+ void putTrap(JS key, Trap value) throws JSExn { throw new JSExn("traps cannot be placed on this object (class=" + this.getClass().getName() +")"); }
+ String coerceToString() throws JSExn { throw new JSExn("can't coerce to a string (class=" + getClass().getName() +")"); }
+ boolean jsequals(JS o) { return this == o; }
+
+ public static class O extends JS {
+ private Hash entries;
+
+ public Enumeration keys() throws JSExn { return entries == null ? emptyEnumeration : entries.keys(); }
+ public JS get(JS key) throws JSExn { return entries == null ? null : (JS)entries.get(key, null); }
+ public void put(JS key, JS val) throws JSExn { (entries==null?entries=new Hash():entries).put(key,null,val); }
+
+ /** retrieve a trap from the entries hash */
+ final Trap getTrap(JS key) {
+ return entries == null ? null : (Trap)entries.get(key, Trap.class);