-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwoThings_Diagram.html
More file actions
90 lines (77 loc) · 2.21 KB
/
TwoThings_Diagram.html
File metadata and controls
90 lines (77 loc) · 2.21 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
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title>TwoThings Class Diagram</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
</head>
<body>
<h1>TwoThings Class Diagram</h1>
<h2>Class Structure</h2>
<div class="mermaid">
classDiagram
class TwoThings {
-T item1
-C item2
+TwoThings(T itemA, C itemB)
+toString() String
+getItem1() T
+getItem2() C
+setItem1(T itemA)
+setItem2(C itemB)
}
class Name {
-String first
-String last
+Name(String firstName, String lastName)
+toString() String
+setFirstName(String firstName)
}
class Fraction {
-Integer numerator
-Integer denominator
+Fraction(Integer num, Integer den)
+toString() String
}
TwoThings --> Name : uses
TwoThings --> Fraction : uses
</div>
<h2>Object Instances in main()</h2>
<div class="mermaid">
graph TD
A["object1: TwoThings<String,Integer>"] --> B["item1: 'Nami'"]
A --> C["item2: 25 → 24"]
D["object2: TwoThings<Name,Fraction>"] --> E["item1: Name"]
D --> F["item2: Fraction(5,2)"]
E --> G["first: 'Nalu' → 'Sally'"]
E --> H["last: 'Suzuki'"]
F --> I["numerator: 5"]
F --> J["denominator: 2"]
</div>
<h2>Program Flow</h2>
<div class="mermaid">
sequenceDiagram
participant M as main()
participant O1 as object1
participant O2 as object2
participant N as Name
participant F as Fraction
M->>O1: create TwoThings<String,Integer>("Nami", 25)
M->>O1: getItem2() returns 25
M->>O1: setItem2(24)
M->>N: create Name("Nalu", "Suzuki")
M->>F: create Fraction(5, 2)
M->>O2: create TwoThings<Name,Fraction>(name, fraction)
M->>O2: getItem1() returns Name
M->>N: setFirstName("Sally")
M->>O2: setItem1(modified name)
</div>
<script>
mermaid.initialize({startOnLoad:true});
</script>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
h1, h2 { color: #333; }
.mermaid { margin: 20px 0; padding: 20px; border: 1px solid #ddd; }
</style>
</body>
</html>