ballwar.model.paint
Class ADecoratorPaintStrategy

java.lang.Object
  extended by ballwar.model.paint.ADecoratorPaintStrategy
All Implemented Interfaces:
IPaintStrategy
Direct Known Subclasses:
FixedColorDecoratorPaintStrategy

public abstract class ADecoratorPaintStrategy
extends Object
implements IPaintStrategy

Abstract class that provides default behavior for subclasses that will decorate another IPaintStrategy to add functionality to that strategy. All this class's methods do is to simply delegate to the decoree. A subclass should override one or more methods, adding additional processing either before or after delegating to the decoree. Note that this class cannot be used by the BallWar system directly as it lacks a no-parameter constructor.


Field Summary
private  IPaintStrategy decoree
          The "decoree" paint strategy whose methods are being augmented by this decorator paint strategy.
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
ADecoratorPaintStrategy(IPaintStrategy decoree)
          Constructor that takes the decoree paint strategy
 
Method Summary
 void init(Ball host)
          Default behavior is to simply delegate to the decoree's init method
 void paint(Graphics g, Ball host)
          Default behavior is to simply delegate to the decoree's paint method
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Default behavior is to simply delegate to the decoree's paintXfrm method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decoree

private IPaintStrategy decoree
The "decoree" paint strategy whose methods are being augmented by this decorator paint strategy.

Constructor Detail

ADecoratorPaintStrategy

public ADecoratorPaintStrategy(IPaintStrategy decoree)
Constructor that takes the decoree paint strategy

Parameters:
decoree - The paint strategy that is to be decorated
Method Detail

paint

public void paint(Graphics g,
                  Ball host)
Default behavior is to simply delegate to the decoree's paint method

Specified by:
paint in interface IPaintStrategy
Parameters:
g - The graphics context which is passed to the decoree
host - The host Ball which is passed to the decoree

paintXfrm

public void paintXfrm(Graphics g,
                      Ball host,
                      AffineTransform at)
Default behavior is to simply delegate to the decoree's paintXfrm method

Specified by:
paintXfrm in interface IPaintStrategy
Parameters:
g - The graphics context which is passed to the decoree
host - The host Ball which is passed to the decoree.
at - The affine transform which is passed to the decoree.

init

public void init(Ball host)
Default behavior is to simply delegate to the decoree's init method

Specified by:
init in interface IPaintStrategy
Parameters:
host - The host Ball which is passed to the decoree.