ballworld.model.strategy
Class CurveStrategy

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

public class CurveStrategy
extends java.lang.Object
implements IUpdateStrategy

Strategy to make the ball curve in a circle

Author:
swong

Field Summary
private  double angle
          Random turning angle
private  double cosA
          Pre-calculated cosine of the turning angle
private  double sinA
          Pre-calculated sine of the turning angle
 
Constructor Summary
CurveStrategy()
           
 
Method Summary
 void updateState(Ball context)
          Rotate the context's velocity by the turning angle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

angle

private double angle
Random turning angle


cosA

private double cosA
Pre-calculated cosine of the turning angle


sinA

private double sinA
Pre-calculated sine of the turning angle

Constructor Detail

CurveStrategy

public CurveStrategy()
Method Detail

updateState

public void updateState(Ball context)
Rotate the context's velocity by the turning angle

Specified by:
updateState in interface IUpdateStrategy
Parameters:
context - The host ball for this strategy