|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectballwar.model.strategy.AUpdateStrategy
public abstract class AUpdateStrategy
Abstract strategy that provides random initialization of a ball.
Field Summary | |
---|---|
private static int |
_MaxRadius
The maximum radius that a ball can have. |
private static int |
_MaxSpeed
The maximum speed a ball may have. |
private Rectangle |
_MaxVel
The minimum and maximum values of a ball's velocityl. |
private static int |
_MinRadius
The minimum radius that a ball can have. |
private static IRandomizer |
_Rand
Randomizer to generate desired random value. |
Fields inherited from interface ballwar.model.IUpdateStrategy |
---|
NullObject |
Constructor Summary | |
---|---|
AUpdateStrategy()
|
Method Summary | |
---|---|
void |
init(Ball context)
Initializes the ball with a random radius, velocity, location (within the bounds of the ball's environment) and color. |
void |
kill(Ball context)
Calls the context's doKill() method to remove it from the system. |
void |
updateCollision(Ball context,
Ball target)
No-op. |
abstract void |
updateState(Ball context)
Abstract behavior relegated to concrete subclass. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final IRandomizer _Rand
private static final int _MaxRadius
private static final int _MinRadius
private static final int _MaxSpeed
private Rectangle _MaxVel
Constructor Detail |
---|
public AUpdateStrategy()
Method Detail |
---|
public abstract void updateState(Ball context)
updateState
in interface IUpdateStrategy
context
- The ball to update.public void init(Ball context)
init
in interface IUpdateStrategy
context
- The ball to initialize.public void updateCollision(Ball context, Ball target)
updateCollision
in interface IUpdateStrategy
context
- not usedtarget
- not usedpublic void kill(Ball context)
kill
in interface IUpdateStrategy
context
- The ball to kill.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |