formatting changes
[org.ibex.js.git] / src / org / ibex / js / JS.java
index 4c69a05..e2fc5c8 100644 (file)
@@ -73,30 +73,23 @@ public interface JS extends Pausable {
         public JS get(JS key) throws JSExn { return null; }
         public void put(JS key, JS val) throws JSExn {
             throw new JSExn("'" + key + "' is read only on class ["+ getClass().getName() +"]"); }
-        public InputStream getInputStream() throws IOException, JSExn { throw new JSExn(
-            "object has not associated stream, class ["+ getClass().getName() +"]"); }
 
         public JS call(JS method, JS[] args) throws JSExn {
             if (method == null) throw new JSExn( "object cannot be called, class ["+ getClass().getName() +"]");
             throw new JSExn("method not found: " + JSU.str(method) + " class="+this.getClass().getName());
         }
         public String[] getFormalArgs() { return emptystr; }
+        public String coerceToString() throws JSExn { throw new JSExn("cannot coerce a "+getClass().getName()+" to a string"); }
 
         public JS putAndTriggerTraps(JS key, JS val) throws JSExn { throw new JSExn(
             "'" + key + "' is trap read only on class ["+ getClass().getName() +"]"); }
         public JS getAndTriggerTraps(JS key) throws JSExn { return null; } // FIXME throw errors?
         public JS justTriggerTraps(JS key, JS value) throws JSExn { return null; }
-
         public void addTrap(JS key, JS function) throws JSExn {
             Log.warn(this, "'" + JSU.str(key) + "' is not trappable on class ["+ getClass().getName() +"]"); }
         public void delTrap(JS key, JS function) throws JSExn {
             Log.warn(this, "'" + JSU.str(key) + "' trap is read only on class ["+ getClass().getName() +"]"); }
-        public Trap getTrap(JS key) throws JSExn {
-            //Log.warn(this, "'" + JSU.str(key) + "' is not trappable on class ["+ getClass().getName() +"]");
-            return null;
-        }
-        public String coerceToString() throws JSExn {
-            throw new JSExn("cannot coerce a " + getClass().getName() + " to a string"); }
+        public Trap getTrap(JS key) throws JSExn { return null; }
     }
 
     public interface Cloneable {}
@@ -112,10 +105,6 @@ public interface JS extends Pausable {
         public Enumeration keys() throws JSExn { return clonee.keys(); }
         public JS get(JS k) throws JSExn { return clonee.get(k); }
         public void put(JS k, JS v) throws JSExn { clonee.put(k, v); }
-
-        // FIMXE: cloning Fountains...
-        //public InputStream getInputStream() throws IOException, JSExn { return clonee.getInputStream(); }
-
         public JS call(JS m, JS[] a) throws JSExn { return clonee.call(m, a); }
         public String[] getFormalArgs() { return clonee.getFormalArgs(); }
         public JS putAndTriggerTraps(JS k, JS v) throws JSExn { return clonee.putAndTriggerTraps(k, v); }
@@ -134,11 +123,10 @@ public interface JS extends Pausable {
         public Obj() { super(3, 4, 0.75F); }
 
         public JS unclone() { return this; }
+        public String[] getFormalArgs() { return emptystr; }
 
         public JS call(JS method, JS[] args) throws JSExn {
-            if (method==null) throw new JSExn("cannot call a " + getClass().getName());
-            throw new JSExn("method not found: " + JSU.str(method)); }
-        public String[] getFormalArgs() { return emptystr; }
+            throw new JSExn(method==null ? "cannot call a " + getClass().getName() : "method not found: " + JSU.str(method)); }
 
         public Enumeration keys() throws JSExn {
             final Object[] keys = super.dumpkeys();
@@ -172,8 +160,8 @@ public interface JS extends Pausable {
         }
 
         public void addTrap(JS key, JS f) throws JSExn {
-            if (f.getFormalArgs() == null || f.getFormalArgs().length > 1) throw new JSExn(
-                "traps must take either one argument (write) or no arguments (read)");
+            if (f.getFormalArgs() == null || f.getFormalArgs().length > 1)
+                throw new JSExn("traps must take either one argument (write) or no arguments (read)");
             for (Trap t = (Trap)super.get(key, 1); t != null; t = t.next())
                 if (t.function().equals(f)) return;
             super.put(key, new TrapHolder(this, key, f, (Trap)super.get(key, 1)), 1);
@@ -189,8 +177,7 @@ public interface JS extends Pausable {
 
         public Trap getTrap(JS key) throws JSExn { return (Trap)super.get(key, 1); }
 
-        public String coerceToString() throws JSExn {
-            throw new JSExn("cannot coerce a " + getClass().getName() + " to a string"); }
+        public String coerceToString() throws JSExn { throw new JSExn("cannot coerce a "+getClass().getName()+" to a string"); }
 
         private static final class Placeholder implements Serializable {}