ballwar.model.strategy
Class UpdateStrategySet
java.lang.Object
ballwar.model.strategy.UpdateStrategySet
- All Implemented Interfaces:
- IUpdateStrategy
public class UpdateStrategySet
- extends Object
- implements IUpdateStrategy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_strategySet
private LRStruct _strategySet
_updateAlgo
private IAlgo _updateAlgo
_collideAlgo
private IAlgo _collideAlgo
_initAlgo
private IAlgo _initAlgo
_killAlgo
private IAlgo _killAlgo
_remStrategyAlgo
private IAlgo _remStrategyAlgo
UpdateStrategySet
public UpdateStrategySet()
addCmd
public void addCmd(IUpdateStrategy strategy)
removeCmd
public IUpdateStrategy removeCmd(IUpdateStrategy strategy)
clear
public void clear()
updateState
public void updateState(Ball context)
- Description copied from interface:
IUpdateStrategy
- Updates the state of the given ball in response to the periodic repainting of the ball as a part of its animation..
Used to modify the position, velocity, color, etc as the ball is moving.
- Specified by:
updateState
in interface IUpdateStrategy
- Parameters:
context
- The ball to update.
updateCollision
public void updateCollision(Ball context,
Ball target)
- Description copied from interface:
IUpdateStrategy
- updates the state of the ball in response to a collision between the two balls.
It is assumed that the context ball is the one that just moved and collided with
the target ball.
- Specified by:
updateCollision
in interface IUpdateStrategy
- Parameters:
context
- The ball that just moved and collided with the target ball.target
- The ball that was not moving and was collided by the context.
init
public void init(Ball context)
- Description copied from interface:
IUpdateStrategy
- Initializes the given ball. Called once by the ball when the strategy is first loaded.
- Specified by:
init
in interface IUpdateStrategy
- Parameters:
context
- The ball to initialize.
kill
public void kill(Ball context)
- Description copied from interface:
IUpdateStrategy
- Processes a "killing" of a ball. Called when a ball's kill() method is called.
A ball will only be removed from the system if its doKill() method is called, perhaps
from the strategy's kill() method.
- Specified by:
kill
in interface IUpdateStrategy
- Parameters:
context
- The ball who's kill method was called.