ballwar.model.strategy
Class ColorStrategy

java.lang.Object
  extended by ballwar.model.strategy.ANoOpStrategy
      extended by 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.
 
Fields inherited from interface ballwar.model.IUpdateStrategy
NullObject
 
Constructor Summary
ColorStrategy()
           
 
Method Summary
 void updateState(Ball context)
          Updates the state of the context by randomly setting its color.
 
Methods inherited from class ballwar.model.strategy.ANoOpStrategy
init, kill, updateCollision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

private IRandomizer rand
Randominzer used to generate the random colors needed.

Constructor Detail

ColorStrategy

public ColorStrategy()
Method Detail

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.