ballwar.model.paint
Class AnimatePaintStrategy

java.lang.Object
  extended by ballwar.model.paint.APaintStrategy
      extended by ballwar.model.paint.AnimatePaintStrategy
All Implemented Interfaces:
IPaintStrategy
Direct Known Subclasses:
SwimFishPaintStrategy

public class AnimatePaintStrategy
extends APaintStrategy

Concrete paint strategy that cycles through a sequence of paint strategies, painting one per paint update. Note: This paint strategy cannot be directly instantiated by the BallWar system because it does not have a no-parameter constructor.


Field Summary
private  int count
          The counter that keeps track of which paint strategy to use next.
private  IPaintStrategy[] paintStrats
          The paint strategies to cycle through
 
Fields inherited from class ballwar.model.paint.APaintStrategy
at
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
AnimatePaintStrategy(AffineTransform at, IPaintStrategy... pstrats)
          Constructor that uses the supplied AffineTransform for internal use.
AnimatePaintStrategy(IPaintStrategy... pstrats)
          Constructor that instantiates an AffineTransform for internal use.
 
Method Summary
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Paints the currently indexed paint strategy on the given Graphics context using the supplied AffineTransform.
 
Methods inherited from class ballwar.model.paint.APaintStrategy
init, paint, paintCfg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paintStrats

private IPaintStrategy[] paintStrats
The paint strategies to cycle through


count

private int count
The counter that keeps track of which paint strategy to use next.

Constructor Detail

AnimatePaintStrategy

public AnimatePaintStrategy(IPaintStrategy... pstrats)
Constructor that instantiates an AffineTransform for internal use.

Parameters:
pstrats - vararg input of the paint strategies to cycle through, in order.

AnimatePaintStrategy

public AnimatePaintStrategy(AffineTransform at,
                            IPaintStrategy... pstrats)
Constructor that uses the supplied AffineTransform for internal use.

Parameters:
at - The AffineTransform to use.
pstrats - vararg input of the paint strategies to cycle through, in order.
Method Detail

paintXfrm

public void paintXfrm(Graphics g,
                      Ball host,
                      AffineTransform at)
Paints the currently indexed paint strategy on the given Graphics context using the supplied AffineTransform. Called by the inherited paint method.

Parameters:
g - The Graphics context to paint upon.
host - The host Ball
at - The AffineTransform to use