forked from purplepixie/BasicShapes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
27 lines (22 loc) · 803 Bytes
/
Application.java
File metadata and controls
27 lines (22 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.List;
import java.util.ArrayList;
public class Application {
public static void main(String[] args)
{
ShapeFactory factory = new ShapeFactory();
List<Shape> shapes = new ArrayList<Shape>();
shapes.add(factory.getShape("circle"));
shapes.add(factory.getShape("circle"));
shapes.add(factory.getShape("square"));
for(Shape s: shapes) {
s.draw();
}
// Example of using the Emphasis decorator
System.out.println("\nShapes with Emphasis:");
Shape emphasizedCircle = new Emphasis(factory.getShape("circle"));
emphasizedCircle.draw();
System.out.println();
Shape emphasizedSquare = new Emphasis(factory.getShape("square"));
emphasizedSquare.draw();
}
}