| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.ExplodeStrategy
public class ExplodeStrategy
An ANoOpStrategy-based strategy that, upon colliding with another ball, may replace its context with a number of smaller balls with the same strategy, unless the context's radius is below a minumum length, upon which the context is simply killed. The size and masses of the new balls are calculated to conservere total area and mass before and after the collision..
| Field Summary | |
|---|---|
| private static int | _MinRadiusThe minimum radius that will explode. | 
| private static int | _NBallsThe number of balls to explode into. | 
| private static double | _ProbThe probability of explosion. | 
| private static int | _RadiusDividerThe divisor of the radius when the ball explodes. | 
| Fields inherited from interface ballwar.model.IUpdateStrategy | 
|---|
| NullObject | 
| Constructor Summary | |
|---|---|
| ExplodeStrategy() | |
| Method Summary | |
|---|---|
|  void | updateCollision(Ball context,
                Ball target)With a given probability, explodes the context ball into a number of smaller balls, unless the context's radius is below a minimum length, upon which the context is killed and no more balls are made. | 
| Methods inherited from class ballwar.model.strategy.ANoOpStrategy | 
|---|
| init, updateKill, updateState | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
private static double _Prob
private static int _MinRadius
private static int _NBalls
private static int _RadiusDivider
| Constructor Detail | 
|---|
public ExplodeStrategy()
| Method Detail | 
|---|
public void updateCollision(Ball context,
                            Ball target)
updateCollision in interface IUpdateStrategyupdateCollision in class ANoOpStrategycontext - The strategy's contexttarget - The ball the context collided with.| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||