API: removed Inbox and Outbox classes, replaced with isInbox(), isOutbox()
authoradam <adam@megacz.com>
Thu, 22 Feb 2007 15:29:11 +0000 (16:29 +0100)
committeradam <adam@megacz.com>
Thu, 22 Feb 2007 15:29:11 +0000 (16:29 +0100)
src/edu/berkeley/fleet/api/BenkoBox.java
src/edu/berkeley/fleet/api/Instruction.java

index cd93a16..d5e3b21 100644 (file)
@@ -17,13 +17,11 @@ public abstract class BenkoBox extends Destination {
      *  or Integer.MAX_VALUE if unbounded */
     public abstract int getInstructionFifoLength();
 
-    public static abstract class Inbox extends BenkoBox {
-        public Inbox() { }
-    }
+    /** returns true if this is an inbox */
+    public abstract boolean isInbox();
 
-    public static abstract class Outbox extends BenkoBox {
-        public Outbox() { }
-    }
+    /** returns true if this is an outbox */
+    public abstract boolean isOutbox();
 
     /** get all destinations associated with this BenkoBox; default implementation: just itself */
     public Iterable<Destination> getDestinations() {
index 5b89965..3aae37b 100644 (file)
@@ -73,7 +73,7 @@ public abstract class Instruction {
             boolean needcomma = false;
             if (tokenIn)           { ret += (needcomma ? ", " : "") + "wait";    needcomma = true; }
             if (dataIn && latch)  {
-                if (benkoBox instanceof BenkoBox.Inbox)
+                if (benkoBox.isInbox())
                     ret += (needcomma ? ", " : "") + "receive";
                 else
                     ret += (needcomma ? ", " : "") + "take";
@@ -81,7 +81,7 @@ public abstract class Instruction {
             }
             if (dataIn && !latch)  { ret += (needcomma ? ", " : "") + "dismiss"; needcomma = true; }
             if (dataOut)  {
-                if (benkoBox instanceof BenkoBox.Inbox || dest==null)
+                if (benkoBox.isInbox() || dest==null)
                     ret += (needcomma ? ", " : "") + "deliver";
                 else
                     ret += (needcomma ? ", " : "") + "sendto "+dest;