ballwar.model.paint
Class MultiPaintStrategy

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

public abstract class MultiPaintStrategy
extends APaintStrategy

A composite design pattern exension of APaintStrategy that paints a set of paint strategies. Note: This paint strategy cannot be used directly by the BallWar system because it lacks a no-parameter constructor.


Field Summary
private  IPaintStrategy[] pstrats
          The set of paint strategies to paint
 
Fields inherited from class ballwar.model.paint.APaintStrategy
at
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
MultiPaintStrategy(AffineTransform at, IPaintStrategy... pstrats)
          Constructor that takes the paint strategies that will part of the composite.
MultiPaintStrategy(IPaintStrategy... pstrats)
          Constructor that takes the paint strategies that will part of the composite.
 
Method Summary
 void init(Ball host)
          Delegates to all the IPaintStrategies in the composite.
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Delegates to all the IPaintStrategies in the composite.
 
Methods inherited from class ballwar.model.paint.APaintStrategy
paint, paintCfg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pstrats

private IPaintStrategy[] pstrats
The set of paint strategies to paint

Constructor Detail

MultiPaintStrategy

public MultiPaintStrategy(IPaintStrategy... pstrats)
Constructor that takes the paint strategies that will part of the composite. An AffineTransform is instantiated for internal use.

Parameters:
pstrats - Vararg parameter that are the paint strategies that will make up the composite.

MultiPaintStrategy

public MultiPaintStrategy(AffineTransform at,
                          IPaintStrategy... pstrats)
Constructor that takes the paint strategies that will part of the composite. An external AffineTransform is supplied for internal use.

Parameters:
at - The AffineTransform to use.
pstrats - Vararg parameter that are the paint strategies that will make up the composite.
Method Detail

paintXfrm

public void paintXfrm(Graphics g,
                      Ball host,
                      AffineTransform at)
Delegates to all the IPaintStrategies in the composite. Paints using 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

init

public void init(Ball host)
Delegates to all the IPaintStrategies in the composite. Used to initialize the paint strategies.

Specified by:
init in interface IPaintStrategy
Overrides:
init in class APaintStrategy
Parameters:
host - The host Ball