package model; import model.shapes.AShapeFactory; import model.shapes.IShape; import model.shapes.NullShape; import java.awt.*; /** * Shapes model. * * @author Mathias Ricken */ public class ShapesModel { /** * Current shape. */ private IShape _shape; /** * Constructor. */ public ShapesModel() { _shape = new NullShape(); } /** * Paint current shape. * @param g graphics object */ public void paint(Graphics g) { _shape.paint(g); } /** * Change the shape by using the factory. * @param factory factory to create new shape */ public void changeShape(AShapeFactory factory) { _shape = factory.makeShape(); } /** * Return array of shape class names. * @return array of class names */ public static String[] getShapeClassNames() { return new String[] { "model.shapes.Ellipse", "model.shapes.Rectangle", "model.shapes.EllipticalArc", "model.shapes.NullShape" }; } }