Ilkka Seppälä c413e0902e
docs: #590 add explanation for bytecode pattern (#1687)
Type: docs and refactoring

Co-authored-by: Subhrodip Mohanta <hello@subho.xyz>
2021-03-22 12:19:46 +05:30

73 lines
2.2 KiB
Plaintext

@startuml
package com.iluwatar.bytecode {
class App {
- LOGGER : Logger {static}
+ App()
+ 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}
- intValue : int
+ getInstruction(value : int) : Instruction {static}
+ getIntValue() : int
+ valueOf(name : String) : Instruction {static}
+ values() : Instruction[] {static}
}
class VirtualMachine {
- LOGGER : Logger {static}
- stack : Stack<Integer>
- wizards : Wizard[]
+ VirtualMachine()
+ VirtualMachine(wizard1 : Wizard, wizard2 : Wizard)
+ execute(bytecode : int[])
+ getAgility(wizard : int) : int
+ getHealth(wizard : int) : int
+ getStack() : Stack<Integer>
+ getWisdom(wizard : int) : int
+ getWizards() : Wizard[]
- randomInt(min : int, max : int) : int
+ 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(health : int, agility : int, wisdom : int, numberOfPlayedSounds : int, numberOfSpawnedParticles : int)
+ getAgility() : int
+ getHealth() : int
+ getNumberOfPlayedSounds() : int
+ getNumberOfSpawnedParticles() : int
+ getWisdom() : int
+ playSound()
+ setAgility(agility : int)
+ setHealth(health : int)
+ setNumberOfPlayedSounds(numberOfPlayedSounds : int)
+ setNumberOfSpawnedParticles(numberOfSpawnedParticles : 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