From: adam Date: Tue, 28 Aug 2007 00:25:34 +0000 (+0100) Subject: improve PumpDescription with left/right specification X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=9e0542f723c494cc9619f8df425c4d6a2587112d;p=fleet.git improve PumpDescription with left/right specification --- diff --git a/src/edu/berkeley/fleet/doc/PumpDescription.java b/src/edu/berkeley/fleet/doc/PumpDescription.java index 907aa81..510f6e8 100644 --- a/src/edu/berkeley/fleet/doc/PumpDescription.java +++ b/src/edu/berkeley/fleet/doc/PumpDescription.java @@ -8,6 +8,7 @@ public class PumpDescription implements Iterable { public String getName() { return name; } public boolean isInbox() { return inbox; } public boolean isOutbox() { return !inbox; } + public boolean isLeft() { return left; } public boolean tokensOnly() { return tokenOnly; } public String getShortcut() { return shortcut; } public Iterator iterator() { return destinations.iterator(); } @@ -19,15 +20,17 @@ public class PumpDescription implements Iterable { private final String name; private final boolean inbox; private final boolean tokenOnly; + private final boolean left; private ArrayList destinations = new ArrayList(); // FIXME public HashMap constants = new HashMap(); - PumpDescription(ShipDescription ship, String name, boolean tokenOnly, boolean inbox) { - this(ship, name, tokenOnly, inbox, null); + PumpDescription(ShipDescription ship, String name, boolean tokenOnly, boolean left, boolean inbox) { + this(ship, name, tokenOnly, inbox, left, null); } - PumpDescription(ShipDescription ship, String name, boolean tokenOnly, boolean inbox, String shortcut) { + PumpDescription(ShipDescription ship, String name, boolean tokenOnly, boolean left, boolean inbox, String shortcut) { + this.left = left; this.ship = ship; this.name = name; this.inbox = inbox; diff --git a/src/edu/berkeley/fleet/doc/ShipDescription.java b/src/edu/berkeley/fleet/doc/ShipDescription.java index df63596..4a4c467 100644 --- a/src/edu/berkeley/fleet/doc/ShipDescription.java +++ b/src/edu/berkeley/fleet/doc/ShipDescription.java @@ -108,7 +108,7 @@ public class ShipDescription implements Iterable { String dest = val.indexOf('.') != -1 ? val.substring(val.indexOf('.')+1) : ""; for (PumpDescription b : pumps) if (b.getName().equals(boxname)) { p = b; break; } - if (p==null) p = new PumpDescription(this, boxname, tokenOnly, inbox); + if (p==null) p = new PumpDescription(this, boxname, tokenOnly, inbox, !rightSide); p.addDest(dest); } }