ballwar.model.paint
Class ShapePaintStrategy

java.lang.Object
  extended by ballwar.model.paint.APaintStrategy
      extended by ballwar.model.paint.ShapePaintStrategy
All Implemented Interfaces:
IPaintStrategy
Direct Known Subclasses:
EllipsePaintStrategy, Fish1PaintStrategy, Fish2PaintStrategy, RectanglePaintStrategy

public class ShapePaintStrategy
extends APaintStrategy

Concrete class that defines invariant painting behaviors for all Shape subclasses. Note: This cannot be directly instantiated by the BallWar system because it does not have a no-parameter constructor.


Field Summary
private  Shape shape
          The Shape to be painted
 
Fields inherited from class ballwar.model.paint.APaintStrategy
at
 
Fields inherited from interface ballwar.model.IPaintStrategy
NullObject
 
Constructor Summary
ShapePaintStrategy(AffineTransform at, Shape shape)
          Constructor that uses a supplied AffineTransform for internal use.
ShapePaintStrategy(Shape shape)
          Constructor that allocates a new AffineTransform for internal use.
 
Method Summary
 void paintXfrm(Graphics g, Ball host, AffineTransform at)
          Paints the shape 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

shape

private Shape shape
The Shape to be painted

Constructor Detail

ShapePaintStrategy

public ShapePaintStrategy(Shape shape)
Constructor that allocates a new AffineTransform for internal use.

Parameters:
shape - The Shape to be painted.

ShapePaintStrategy

public ShapePaintStrategy(AffineTransform at,
                          Shape shape)
Constructor that uses a supplied AffineTransform for internal use.

Parameters:
at - The AffineTransform to use
shape - The Shape to be painted.
Method Detail

paintXfrm

public void paintXfrm(Graphics g,
                      Ball host,
                      AffineTransform at)
Paints the shape 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