ballwar.model.paint.shape
Class RectangleShapeFactory

java.lang.Object
  extended by ballwar.model.paint.shape.RectangleShapeFactory
All Implemented Interfaces:
IShapeFactory

public class RectangleShapeFactory
extends Object
implements IShapeFactory

Concrete IShapeFactory that instantiates Rectangle2d.Double shapes.


Field Summary
static RectangleShapeFactory Singleton
          Singleton pattern
 
Constructor Summary
private RectangleShapeFactory()
           
 
Method Summary
 Shape makeShape(double x, double y, double xScale, double yScale)
          Instantiates a Rectangle2D.Double object at the specified orign and size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final RectangleShapeFactory Singleton
Singleton pattern

Constructor Detail

RectangleShapeFactory

private RectangleShapeFactory()
Method Detail

makeShape

public Shape makeShape(double x,
                       double y,
                       double xScale,
                       double yScale)
Instantiates a Rectangle2D.Double object at the specified orign and size.

Specified by:
makeShape in interface IShapeFactory
Parameters:
x - The x-coordinate of the center of the prototype rectangle
y - The y-coordinate of the center of the prototype rectangle
xScale - The half-width of the rectangle, i.e. the width as measured from the center.
yScale - The half-hieght of the rectangle, i.e. the height as measured from the center.
Returns:
A Rectangle2D.Double instance