From: adam Date: Thu, 22 Feb 2007 15:30:26 +0000 (+0100) Subject: API: inert changes (cleanup, visibility, toString()) X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=feb7eddcff3f5c15579749cd4eb4b40d2b4067b5;p=fleet.git API: inert changes (cleanup, visibility, toString()) --- diff --git a/src/edu/berkeley/fleet/api/BenkoBox.java b/src/edu/berkeley/fleet/api/BenkoBox.java index 0c05e0d..e9a8cc4 100644 --- a/src/edu/berkeley/fleet/api/BenkoBox.java +++ b/src/edu/berkeley/fleet/api/BenkoBox.java @@ -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) */ diff --git a/src/edu/berkeley/fleet/api/Destination.java b/src/edu/berkeley/fleet/api/Destination.java index 6d5bf81..c7a0686 100644 --- a/src/edu/berkeley/fleet/api/Destination.java +++ b/src/edu/berkeley/fleet/api/Destination.java @@ -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(); diff --git a/src/edu/berkeley/fleet/api/FleetProcess.java b/src/edu/berkeley/fleet/api/FleetProcess.java index c5aad72..096c29e 100644 --- a/src/edu/berkeley/fleet/api/FleetProcess.java +++ b/src/edu/berkeley/fleet/api/FleetProcess.java @@ -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; } diff --git a/src/edu/berkeley/fleet/api/Instruction.java b/src/edu/berkeley/fleet/api/Instruction.java index 3aae37b..6482198 100644 --- a/src/edu/berkeley/fleet/api/Instruction.java +++ b/src/edu/berkeley/fleet/api/Instruction.java @@ -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; } } }