-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask2_class.pu
73 lines (65 loc) · 1.3 KB
/
task2_class.pu
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
@startuml
class Snake {
-static Snake theSnake
-Sorter sorter
+static Snake getTheSnake()
+void setSorter(Sorter sorter)
+String lineUp(Line line)
+String[] parsePlan(String plan)
+void execute(String step)
}
class SelectSorter {
-int[] a
+void load(int[] elements)
+void swap(int i, int j)
+void sort()
+String getPlan()
}
class QuickSorter {
-int[] a
+void load(int[] elements)
+void sort()
+String getPlan()
+void swap(int i, int j)
+void quickSort(int left, int right)
}
class Monster {
-int r, g, b
-Position position
+void setPosition(Position position)
+Position getPosition()
+void swapPosition(Monster another)
+int getValue()
+Monster getArrayEle(int index)
+Monster getMonsterByRank(int rank)
+int rank()
}
class Line {
-Position[] positions
+void put(Linable linable, int i)
+Linable get(int i)
+Linable[] toArray()
+void shuffle()
}
interface Sorter {
+void load(int[] elements)
+void sort()
+String getPlan()
}
interface Linable {
+void setPosition(Position position)
+Position getPosition()
+int getValue()
}
class Position {
-Linable linable
+void setLinable(Linable linable)
}
Snake --> Sorter
Snake --> Line
SelectSorter ..|> Sorter
QuickSorter ..|> Sorter
Monster ..|> Linable
Line --> Position
Position --> Linable
@enduml