ballworld.model.strategy
Class Change1Strategy

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

public class Change1Strategy
extends java.lang.Object
implements IUpdateStrategy

A composite strategy that switches the context's strategy to a Change2Strategy after a certain number of updates.

Author:
swong

Field Summary
private  int count
          The number of updates before the context's strategy is changed.
private  IUpdateStrategy s1
          One of the composee strategies
private  IUpdateStrategy s2
          One of the composee strategies
private  IUpdateStrategy s3
          One of the composee strategies
 
Constructor Summary
Change1Strategy()
          Constructor for the strategy.
 
Method Summary
 void updateState(Ball context)
          Run all three composee strategies and if the count goes to zero, change the context's strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s1

private IUpdateStrategy s1
One of the composee strategies


s2

private IUpdateStrategy s2
One of the composee strategies


s3

private IUpdateStrategy s3
One of the composee strategies


count

private int count
The number of updates before the context's strategy is changed.

Constructor Detail

Change1Strategy

public Change1Strategy()
Constructor for the strategy. Composee strategy initializations are being done here so that the composition lines will show up in a Green UML 3.5.0 diagram.

Method Detail

updateState

public void updateState(Ball context)
Run all three composee strategies and if the count goes to zero, change the context's strategy.

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