change benkobox=>pump
[fleet.git] / src / edu / berkeley / fleet / api / Instruction.java
index 0be7246..a32b8d0 100644 (file)
@@ -4,11 +4,11 @@ public abstract class Instruction {
 
     public static class Kill extends Instruction {
 
-        public final BenkoBox benkoBox;
+        public final Pump pump;
         public final int      count;
         public final boolean  killOnlyStandingInstructions;
-        public Kill(BenkoBox benkoBox, int count, boolean killOnlyStandingInstructions) {
-            this.benkoBox=benkoBox;
+        public Kill(Pump pump, int count, boolean killOnlyStandingInstructions) {
+            this.pump=pump;
             this.count=count;
             this.killOnlyStandingInstructions = killOnlyStandingInstructions;
             if (killOnlyStandingInstructions && count !=1)
@@ -20,33 +20,36 @@ public abstract class Instruction {
 
     public static class Executable extends Instruction {
 
-        public final BenkoBox    benkoBox;
+        public final Pump    pump;
         public final Destination dest;
         public final int         count;
 
         public final boolean  tokenIn;
         public final boolean  dataIn;
         public final boolean  latch;
+        public final boolean  dataOutDest;
         public final boolean  dataOut;
         public final boolean  tokenOut;
         public final boolean  requeue;
 
         /** count=0 denotes a standing move */
-        public Executable(BenkoBox    benkoBox,
+        public Executable(Pump    pump,
                           Destination dest,
                           int         count,
                           boolean     tokenIn,
                           boolean     dataIn,
                           boolean     latch,
+                          boolean     dataOutDest,
                           boolean     dataOut,
                           boolean     tokenOut,
                           boolean     requeue) {
-            this.benkoBox = benkoBox;
+            this.pump = pump;
             this.dest = dest;
             this.count = count;
             this.tokenIn = tokenIn;
             this.dataIn = dataIn;
             this.latch = latch;
+            this.dataOutDest = dataOutDest;
             this.dataOut = dataOut;
             this.tokenOut = tokenOut;
             this.requeue = requeue;
@@ -60,12 +63,12 @@ public abstract class Instruction {
 
         public Instruction.Executable decrementCount() {
             if (count==1) return null;
-            return new Executable(benkoBox, dest, count==0 ? 0 : count-1,
-                                  tokenIn, dataIn, latch, dataOut, tokenOut, requeue);
+            return new Executable(pump, dest, count==0 ? 0 : count-1,
+                                  tokenIn, dataIn, latch, dataOutDest, dataOut, tokenOut, requeue);
         }
 
         public String toString() {
-            String ret = benkoBox.toString() + ": ";
+            String ret = pump.toString() + ": ";
             if (count==0 || count>1 || requeue) {
                 ret += requeue ? "(" : "[";
                 if (count>1) ret += count;
@@ -75,7 +78,7 @@ public abstract class Instruction {
             boolean needcomma = false;
             if (tokenIn)           { ret += (needcomma ? ", " : "") + "wait";    needcomma = true; }
             if (dataIn && latch)  {
-                if (benkoBox.isInbox())
+                if (pump.isInbox())
                     ret += (needcomma ? ", " : "") + "receive";
                 else
                     ret += (needcomma ? ", " : "") + "take";
@@ -83,7 +86,7 @@ public abstract class Instruction {
             }
             if (dataIn && !latch)  { ret += (needcomma ? ", " : "") + "dismiss"; needcomma = true; }
             if (dataOut)  {
-                if (benkoBox.isInbox() || dest==null)
+                if (pump.isInbox() || dest==null)
                     ret += (needcomma ? ", " : "") + "deliver";
                 else
                     ret += (needcomma ? ", " : "") + "sendto "+dest;