4 private static void main1() {
5 Point p1
= new Point(1, 2);
6 Point p2
= new Point(2, 7);
7 Segment segment
= new Segment(p1
, p2
);
8 Point p3
= new Point(4, 5);
9 Cercle cercle
= new Cercle(p3
, 5.2);
10 Point p4
= new Point(2, 3);
11 Piletransformations trans
= new Piletransformations(10);
13 boolean rt
= trans
.empiler(p4
);
15 System
.out
.println("Echec empilation");
18 segment
.dessiner(trans
);
19 cercle
.dessiner(trans
);
21 Point p5
= new Point(3, 5);
25 Image image
= new Image();
26 image
.ajouter(segment
);
27 image
.ajouter(cercle
);
28 image
.dessiner(trans
);
30 image
.dessiner(trans
);
35 private static void main2() {
36 Point p1
= new Point(1, 2);
37 Point p2
= new Point(2, 7);
38 Segment segment1
= new Segment(p1
, p2
);
39 Point p3
= new Point(1, 5);
40 Point p4
= new Point(3, 1);
41 Segment segment2
= new Segment(p3
, p4
);
42 Point p5
= new Point(4, 5);
43 Cercle cercle1
= new Cercle(p5
, 5.2);
44 Point p6
= new Point(5, 4);
45 Cercle cercle2
= new Cercle(p6
, 4.3);
46 Point point1
= new Point(8, -1.5);
47 Image image1
= new Image();
48 Image image2
= new Image();
49 Image image3
= new Image();
50 Piletransformations transformations
= new Piletransformations(10);
52 transformations
.empiler(point1
);
53 image1
.ajouter(segment1
);
54 image1
.ajouter(cercle1
);
55 image2
.ajouter(segment2
);
56 image2
.ajouter(cercle2
);
57 image1
.dessiner(transformations
);
58 image2
.dessiner(transformations
);
59 Point point2
= new Point(0.5, 2.5);
60 image1
.deplacer(point2
);
61 image3
.ajouter(image1
);
62 image3
.ajouter(image2
);
63 image3
.dessiner(transformations
);
64 transformations
.depiler();
67 public static void main3() {
69 Affichable
[] affichable
= new Affichable
[10];
71 Point p1
= new Point(1, 2);
72 Point p2
= new Point(2, 7);
73 Point p3
= new Point(1, 5);
75 Entiers entiers
= new Entiers(5);
80 Liste liste
= new Liste();
85 for (int i
= 0; i
< 10; i
++) {
86 affichable
[i
] = entiers
;
87 affichable
[i
].afficher();
89 affichable
[i
] = liste
;
90 affichable
[i
].afficher();
92 affichable
[i
] = new Segment(p1
, p2
);
93 affichable
[i
].afficher();
95 affichable
[i
] = new Cercle(p3
, 5.5);
96 affichable
[i
].afficher();
101 public static void main4() {
103 Compactable
[] compactable
= new Compactable
[10];
105 Point p1
= new Point(1, 2);
106 Point p2
= new Point(2, 7);
107 Point p3
= new Point(1, 5);
108 Point p4
= new Point(3, 1);
110 Segment segment1
= new Segment(p1
, p2
);
111 Segment segment2
= new Segment(p3
, p4
);
112 Cercle cercle
= new Cercle(p3
, 5.5);
113 Image image
= new Image();
114 image
.ajouter(segment1
);
115 image
.ajouter(segment2
);
116 image
.ajouter(cercle
);
118 Entiers entiers
= new Entiers(5);
123 Liste liste
= new Liste();
129 compactable
[0] = entiers
;
131 compactable
[0].compacter(1);
134 compactable
[1] = liste
;
136 compactable
[1].compacter(1);
139 compactable
[2] = image
;
141 compactable
[2].compacter(1);
145 public static void main(String
[] args
) {