projects
/
fleet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0b1b44e
)
add ShipPool.setParent()
author
Adam Megacz
<adam@megacz.com>
Mon, 27 Jul 2009 03:23:13 +0000
(20:23 -0700)
committer
Adam Megacz
<adam@megacz.com>
Mon, 27 Jul 2009 03:23:13 +0000
(20:23 -0700)
src/edu/berkeley/fleet/loops/ShipPool.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/fleet/loops/ShipPool.java
b/src/edu/berkeley/fleet/loops/ShipPool.java
index
f120139
..
1d35e1d
100644
(file)
--- a/
src/edu/berkeley/fleet/loops/ShipPool.java
+++ b/
src/edu/berkeley/fleet/loops/ShipPool.java
@@
-63,4
+63,17
@@
public class ShipPool implements Iterable<Ship> {
for (Ship ship : toRelease)
releaseShip(ship);
}
for (Ship ship : toRelease)
releaseShip(ship);
}
+
+ public void setParent(ShipPool parent) {
+ if (this.parent!=null) {
+ for (Ship ship : allocatedShips)
+ this.parent.releaseShip(ship);
+ this.parent = null;
+ }
+ if (parent != null) {
+ for (Ship ship : allocatedShips)
+ parent.allocateShip(ship);
+ }
+ this.parent = parent;
+ }
}
}