Package | Description |
---|---|
ballworld.model | |
ballworld.model.strategy |
Modifier and Type | Field and Description |
---|---|
private Dispatcher |
BallModel._dispatcher
The dispatcher that updates all the balls.
|
Modifier and Type | Method and Description |
---|---|
void |
IBallCmd.apply(Ball context,
Dispatcher disp)
The method run by the ball's update method which is called when the ball is updated by the dispatcher.
|
void |
IUpdateStrategy.updateState(Ball context,
Dispatcher disp)
Abstract method to update the state of a ball
|
void |
Ball.updateState(Dispatcher disp)
Update the state of the ball.
|
Modifier and Type | Method and Description |
---|---|
void |
WanderStrategy.updateState(Ball context,
Dispatcher disp)
Add random values to both the x and y components of the velocity of hte context ball.
|
void |
SwitcherStrategy.updateState(Ball context,
Dispatcher disp)
Delegates to the decoree strategy as the context's strategy.
|
void |
StraightStrategy.updateState(Ball context,
Dispatcher disp)
No-op.
|
void |
MultiStrategy.updateState(Ball context,
Dispatcher disp)
Update each composee strategy in turn.
|
void |
DrunkenStrategy.updateState(Ball context,
Dispatcher disp)
Randomly select one of the possible strategies and run it as the strategy
for the context.
|
void |
CurveStrategy.updateState(Ball context,
Dispatcher disp)
Rotate the context's velocity by the turning angle
|
void |
ColorStrategy.updateState(Ball context,
Dispatcher disp)
Set the context's color to a random color value.
|
void |
Change2Strategy.updateState(Ball context,
Dispatcher disp)
Do nothing unless the count has gone to zero, then change the context's
strategy
|
void |
Change1Strategy.updateState(Ball context,
Dispatcher disp)
Run all three composee strategies and if the count goes to zero, change the context's strategy.
|
void |
BreathingStrategy.updateState(Ball context,
Dispatcher disp)
Set the context's radius to the next value in the sinusoid.
|