improve PumpDescription with left/right specification
authoradam <adam@megacz.com>
Tue, 28 Aug 2007 00:25:34 +0000 (01:25 +0100)
committeradam <adam@megacz.com>
Tue, 28 Aug 2007 00:25:34 +0000 (01:25 +0100)
src/edu/berkeley/fleet/doc/PumpDescription.java
src/edu/berkeley/fleet/doc/ShipDescription.java

index 907aa81..510f6e8 100644 (file)
@@ -8,6 +8,7 @@ public class PumpDescription implements Iterable<String> {
     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<String> iterator() { return destinations.iterator(); }
@@ -19,15 +20,17 @@ public class PumpDescription implements Iterable<String> {
     private final String name;
     private final boolean inbox;
     private final boolean tokenOnly;
+    private final boolean left;
     private ArrayList<String> destinations = new ArrayList<String>();
 
     // FIXME
     public HashMap<String,Constant> constants = new HashMap<String,Constant>();
 
-    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;
index df63596..4a4c467 100644 (file)
@@ -108,7 +108,7 @@ public class ShipDescription implements Iterable<PumpDescription> {
                 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);
             }
         }