From: adam Date: Thu, 22 Feb 2007 15:29:11 +0000 (+0100) Subject: API: removed Inbox and Outbox classes, replaced with isInbox(), isOutbox() X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b815f4269bdaab6ea0dd71c1a9a45901d483a144;p=fleet.git API: removed Inbox and Outbox classes, replaced with isInbox(), isOutbox() --- diff --git a/src/edu/berkeley/fleet/api/BenkoBox.java b/src/edu/berkeley/fleet/api/BenkoBox.java index cd93a16..d5e3b21 100644 --- a/src/edu/berkeley/fleet/api/BenkoBox.java +++ b/src/edu/berkeley/fleet/api/BenkoBox.java @@ -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 getDestinations() { diff --git a/src/edu/berkeley/fleet/api/Instruction.java b/src/edu/berkeley/fleet/api/Instruction.java index 5b89965..3aae37b 100644 --- a/src/edu/berkeley/fleet/api/Instruction.java +++ b/src/edu/berkeley/fleet/api/Instruction.java @@ -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;