Class BallFlyweight


public class BallFlyweight
extends ABall
The flyweight class that determines a Ball's radius, color, and update strategy. This is a shared flyweight, so all balls share the same radius, color and update strategy.


Variable Index

 o color
 o container
 o radius
 o strategy

Constructor Index

 o BallFlyweight (int, Color, Container, AStrategy)

Method Index

 o getColor ()
 o getContainer ()
 o getRadius ()
 o getStrategy ()
 o move (Ball)
 o paint (Graphics, Point)
 o setColor (Color)
 o setRadius (int)
 o setStrategy (AStrategy)
 o update (Graphics, final Ball)

Variables

 o radius
protected int radius
 o color
protected Color color
 o container
protected Container container
 o strategy
protected AStrategy strategy

Constructors

 o BallFlyweight
public  BallFlyweight(int r, Color col, Container c, AStrategy a)

Methods

 o getRadius
public int getRadius()
 o setRadius
public void setRadius(int r)
 o getColor
public Color getColor()
 o setColor
public void setColor(Color c)
 o getContainer
public Container getContainer()
 o getStrategy
public AStrategy getStrategy()
 o update
public void update(Graphics g, final Ball b)
 o move
protected void move(Ball b)
 o paint
protected void paint(Graphics g, Point loc)
 o setStrategy
public void setStrategy(AStrategy strategy)
Parameters:
strategy -