ballwar.model.strategy
Class ColorStrategy
java.lang.Object
ballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.ColorStrategy
- All Implemented Interfaces:
- IUpdateStrategy
public class ColorStrategy
- extends ANoOpStrategy
ANoOpStrategy-based strategy that randomly sets the context's color each time its updateState() method is called.
Field Summary |
private IRandomizer |
rand
Randominzer used to generate the random colors needed. |
Method Summary |
void |
updateState(Ball context)
Updates the state of the context by randomly setting its color. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rand
private IRandomizer rand
- Randominzer used to generate the random colors needed.
ColorStrategy
public ColorStrategy()
updateState
public void updateState(Ball context)
- Updates the state of the context by randomly setting its color.
- Specified by:
updateState
in interface IUpdateStrategy
- Overrides:
updateState
in class ANoOpStrategy
- Parameters:
context
- The ball to update.