ballwar.model.paint
Class MultiPaintStrategy
java.lang.Object
ballwar.model.paint.APaintStrategy
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pstrats
private IPaintStrategy[] pstrats
- The set of paint strategies to paint
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.
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 Ballat
- 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