add ShipPool.assertAllocated()
authorAdam Megacz <adam@megacz.com>
Sat, 1 Aug 2009 01:42:47 +0000 (18:42 -0700)
committerAdam Megacz <adam@megacz.com>
Sat, 1 Aug 2009 01:42:47 +0000 (18:42 -0700)
src/edu/berkeley/fleet/loops/ShipPool.java

index 1d35e1d..27dbff1 100644 (file)
@@ -76,4 +76,11 @@ public class ShipPool implements Iterable<Ship> {
         }
         this.parent = parent;
     }
+
+    public void assertAllocated(Ship ship) {
+        if (allocatedShips.contains(ship)) return;
+        if (parent==null) throw new RuntimeException("assertAllocated() failed");
+        parent.assertAllocated(ship);
+    }
+
 }