forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbytecode.urm.puml
69 lines (69 loc) · 1.9 KB
/
bytecode.urm.puml
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
@startuml
package com.iluwatar.bytecode {
class App {
- LOGGER : Logger {static}
+ App()
- interpretInstruction(instruction : String, vm : VirtualMachine) {static}
+ main(args : String[]) {static}
}
enum Instruction {
+ ADD {static}
+ DIVIDE {static}
+ GET_AGILITY {static}
+ GET_HEALTH {static}
+ GET_WISDOM {static}
+ LITERAL {static}
+ PLAY_SOUND {static}
+ SET_AGILITY {static}
+ SET_HEALTH {static}
+ SET_WISDOM {static}
+ SPAWN_PARTICLES {static}
- value : int
+ getInstruction(value : int) : Instruction {static}
+ getIntValue() : int
+ valueOf(name : String) : Instruction {static}
+ values() : Instruction[] {static}
}
class VirtualMachine {
- stack : Stack<Integer>
- wizards : Wizard[]
+ VirtualMachine()
+ execute(bytecode : int[])
+ getAgility(wizard : int) : int
+ getHealth(wizard : int) : int
+ getStack() : Stack<Integer>
+ getWisdom(wizard : int) : int
+ getWizards() : Wizard[]
+ setAgility(wizard : int, amount : int)
+ setHealth(wizard : int, amount : int)
+ setWisdom(wizard : int, amount : int)
}
class Wizard {
- LOGGER : Logger {static}
- agility : int
- health : int
- numberOfPlayedSounds : int
- numberOfSpawnedParticles : int
- wisdom : int
+ Wizard()
+ getAgility() : int
+ getHealth() : int
+ getNumberOfPlayedSounds() : int
+ getNumberOfSpawnedParticles() : int
+ getWisdom() : int
+ playSound()
+ setAgility(agility : int)
+ setHealth(health : int)
+ setWisdom(wisdom : int)
+ spawnParticles()
}
}
package com.iluwatar.bytecode.util {
class InstructionConverterUtil {
+ InstructionConverterUtil()
+ convertToByteCode(instructions : String) : int[] {static}
- isValidInstruction(instruction : String) : boolean {static}
- isValidInt(value : String) : boolean {static}
}
}
@enduml