ballwar.model.strategy
Class CurveStrategy

java.lang.Object
  extended by ballwar.model.strategy.ANoOpStrategy
      extended by ballwar.model.strategy.CurveStrategy
All Implemented Interfaces:
IUpdateStrategy

public class CurveStrategy
extends ANoOpStrategy

ANoOpStrategy-based strategy that continuously modifies the velocity to produce circular motion.


Field Summary
private  double angle
          The incremental amount to rotate the context's velocity by each time its updateState is called (in radians).
private  double cosA
          Precalculated value of cos(angle)
private  IRandomizer rand
          Randomizer used to randomly generate the increment angle.
private  double sinA
          Pre-calculated value of sin(angle)
 
Fields inherited from interface ballwar.model.IUpdateStrategy
NullObject
 
Constructor Summary
CurveStrategy()
           
 
Method Summary
 void updateState(Ball context)
          Rotates the context's velocity by the specified angle.
 
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
Randomizer used to randomly generate the increment angle.


angle

private double angle
The incremental amount to rotate the context's velocity by each time its updateState is called (in radians).


cosA

private double cosA
Precalculated value of cos(angle)


sinA

private double sinA
Pre-calculated value of sin(angle)

Constructor Detail

CurveStrategy

public CurveStrategy()
Method Detail

updateState

public void updateState(Ball context)
Rotates the context's velocity by the specified angle.

Specified by:
updateState in interface IUpdateStrategy
Overrides:
updateState in class ANoOpStrategy
Parameters:
context - The strategy's context