add ShipPool.assertAllocated()
[fleet.git] / 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);
+    }
+
 }