73 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			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 |