+
+ 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);
+ }
+
+ /** retrieve a trap from the entries hash */
+ final void putTrap(JS key, Trap value) {
+ if (entries == null) entries = new Hash();
+ entries.put(key, Trap.class, value);
+ }
+ }
+
+ public static class BT extends O {
+ private BalancedTree bt;
+ private final BalancedTree bt() { if(bt != null) return bt; return bt = new BalancedTree(); }
+ public final void insertNode(int index, Object o) { bt().insertNode(index,o); }
+ public final void clear() { bt().clear(); }
+ public final Object getNode(int i) { return bt().getNode(i); }
+ public final int treeSize() { return bt().treeSize(); }
+ public final Object deleteNode(int i) { return bt().deleteNode(i); }
+ public final void replaceNode(int index, Object o) { bt().replaceNode(index,o); }
+ public final int indexNode(Object o) { return bt().indexNode(o); }
+ }
+