- public abstract Object get(Object key) throws JS.Exn;
- public void put(Object key, Object val) throws JS.Exn { throw new JS.Exn("you cannot put to this object"); }
+ // this gets around a wierd fluke in the Java type checking rules for ?..:
+ public static final Object T = Boolean.TRUE;
+ public static final Object F = Boolean.FALSE;
+
+ // FEATURE: be smart here; perhaps intern
+ public static final Number N(int i) { return new Integer(i); }
+ public static final Number N(long l) { return new Long(l); }
+ public static final Number N(double d) { return new Double(d); }
+ public static final Boolean B(boolean b) { return b ? Boolean.TRUE : Boolean.FALSE; }
+
+ private static Enumeration emptyEnumeration = new Enumeration() {
+ public boolean hasMoreElements() { return false; }
+ public Object nextElement() { throw new NoSuchElementException(); }
+ };
+
+ private Hash entries = null;
+ public Enumeration keys() { return entries == null ? emptyEnumeration : entries.keys(); }
+ public Object get(Object key) { return entries == null ? null : entries.get(key, null); }
+ public void put(Object key, Object val) { if (entries == null) entries = new Hash(); entries.put(key, null, val); }