API: inert changes (cleanup, visibility, toString())
authoradam <adam@megacz.com>
Thu, 22 Feb 2007 15:30:26 +0000 (16:30 +0100)
committeradam <adam@megacz.com>
Thu, 22 Feb 2007 15:30:26 +0000 (16:30 +0100)
src/edu/berkeley/fleet/api/BenkoBox.java
src/edu/berkeley/fleet/api/Destination.java
src/edu/berkeley/fleet/api/FleetProcess.java
src/edu/berkeley/fleet/api/Instruction.java

index 0c05e0d..e9a8cc4 100644 (file)
@@ -3,8 +3,6 @@ import java.util.*;
 
 public abstract class BenkoBox extends Destination {
 
-    /** you should extend subclasses, not this class directly */
-    //FIXME
     public BenkoBox() { }
 
     /** the descriptive name of this benkobox (relative to its ship) */
index 6d5bf81..c7a0686 100644 (file)
@@ -2,7 +2,7 @@ package edu.berkeley.fleet.api;
 
 public abstract class Destination {
 
-    Destination() { }
+    public Destination() { }
 
     /** return the Ship to which this BenkoBox belongs */
     public abstract Ship   getShip();
index c5aad72..096c29e 100644 (file)
@@ -16,13 +16,13 @@ public abstract class FleetProcess {
     /** subclasses may be assured that this will be called exactly once */
     protected abstract void _terminate();
 
-    public synchronized void terminate() {
+    public final synchronized void terminate() {
         if (terminated) return;
         terminated = true;
         _terminate();
     }
 
-    public boolean isTerminated() {
+    public final boolean isTerminated() {
         return terminated;
     }
 
index 3aae37b..6482198 100644 (file)
@@ -11,8 +11,10 @@ public abstract class Instruction {
             this.benkoBox=benkoBox;
             this.count=count;
             this.killOnlyStandingInstructions = killOnlyStandingInstructions;
+            if (killOnlyStandingInstructions && count !=1)
+                throw new RuntimeException("currently, kill* must have count=1");
         }
-        public String toString() { return (count>1 ? "["+count+"] " : "") + "kill"; }
+        public String toString() { return (count>1 ? "["+count+"] " : "") + "kill" + (killOnlyStandingInstructions ? "*" : ""); }
 
     }
 
@@ -125,7 +127,7 @@ public abstract class Instruction {
             public String toString() {
                 String off = ""+offset;
                 if (offset > 0) off = "+"+off;
-                return "(@"+off+":"+size+"): sendto " + dest;
+                return "(CBD @"+off+"+"+size+"): sendto " + dest;
             }
         }
     }