Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
ShapeFactory.java
Go to the documentation of this file.
1package com.example.graphics.factory;
2
3import com.example.graphics.model.Circle;
4import com.example.graphics.model.Line;
5import com.example.graphics.model.Rectangle;
6import com.example.graphics.model.Shape;
7import com.example.graphics.model.Triangle;
8
13public class ShapeFactory {
21 public Shape createCircle(int x, int y, int radius) {
22 return new Circle(x, y, radius);
23 }
24
33 public Shape createRectangle(int x, int y, int width, int height) {
34 return new Rectangle(x, y, width, height);
35 }
36
45 public Shape createLine(int x1, int y1, int x2, int y2) {
46 return new Line(x1, y1, x2, y2);
47 }
48
59 public Shape createTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
60 return new Triangle(x1, y1, x2, y2, x3, y3);
61 }
62}
Shape createRectangle(int x, int y, int width, int height)
Shape createCircle(int x, int y, int radius)
Shape createTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
Shape createLine(int x1, int y1, int x2, int y2)