- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComposite.java
More file actions
Latest commit
82 lines (63 loc) · 1.47 KB
/
Copy pathComposite.java
File metadata and controls
82 lines (63 loc) · 1.47 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
WeChat: cstutorcs
QQ: 749389476
Email: tutorcs@163.com
importjava.util.Scanner;
publicclassCompositeextendsPolyhedron {
/**
* Collection of polyhedra of which
* this composite polyhedron is composed
*/
privatePolyhedron[] polyhedra;
/**
* Default Constructor
*/
Composite()
{
super("Composite");
polyhedra = null;
}
/**
* Copy Constructor
*/
Composite(Compositesrc)
{
super("Composite");
// Start with copy code
// do not forget to check if
// polyhedra is null
}
/**
* Read all component polyhedra
*
* @pre polyhedra == null
* && numPolyhedra == 0
*/
publicvoidread(Scannerscanner)
{
intnumPolyhedra = scanner.nextInt();
polyhedra = newPolyhedron[numPolyhedra];
for (inti = 0; i < polyhedra.length; i++) {
polyhedra[i] = Polyhedron.createAndRead(scanner);
boundingBox.merge(polyhedra[i].getBoundingBox());
}
}
publicPolyhedronclone()
{
returnnewComposite(this);
}
publicvoidscale(doublescalingFactor)
{
// loop
}
/**
* Scale all polyhedra
*/
publicStringtoString()
{
StringBuilderbld = newStringBuilder();
bld.append(super.toString());
// Start your toString code here
//end your toString code here
returnbld.toString();
}
}