2016-08-30 13:29:12 +02:00
|
|
|
@startuml
|
|
|
|
package com.iluwatar.strategy {
|
2016-11-26 12:51:06 +01:00
|
|
|
class App {
|
|
|
|
- LOGGER : Logger {static}
|
|
|
|
+ App()
|
|
|
|
+ main(args : String[]) {static}
|
|
|
|
}
|
2016-08-30 13:29:12 +02:00
|
|
|
class DragonSlayer {
|
|
|
|
- strategy : DragonSlayingStrategy
|
|
|
|
+ DragonSlayer(strategy : DragonSlayingStrategy)
|
|
|
|
+ changeStrategy(strategy : DragonSlayingStrategy)
|
|
|
|
+ goToBattle()
|
|
|
|
}
|
|
|
|
interface DragonSlayingStrategy {
|
|
|
|
+ execute() {abstract}
|
|
|
|
}
|
|
|
|
class MeleeStrategy {
|
2016-11-26 12:51:06 +01:00
|
|
|
- LOGGER : Logger {static}
|
2016-08-30 13:29:12 +02:00
|
|
|
+ MeleeStrategy()
|
|
|
|
+ execute()
|
|
|
|
}
|
2016-09-18 17:51:09 +03:00
|
|
|
class ProjectileStrategy {
|
2016-11-26 12:51:06 +01:00
|
|
|
- LOGGER : Logger {static}
|
2016-09-18 17:51:09 +03:00
|
|
|
+ ProjectileStrategy()
|
|
|
|
+ execute()
|
|
|
|
}
|
|
|
|
class SpellStrategy {
|
2016-11-26 12:51:06 +01:00
|
|
|
- LOGGER : Logger {static}
|
2016-09-18 17:51:09 +03:00
|
|
|
+ SpellStrategy()
|
|
|
|
+ execute()
|
2016-08-30 13:29:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DragonSlayer --> "-strategy" DragonSlayingStrategy
|
|
|
|
MeleeStrategy ..|> DragonSlayingStrategy
|
2016-09-18 17:51:09 +03:00
|
|
|
ProjectileStrategy ..|> DragonSlayingStrategy
|
|
|
|
SpellStrategy ..|> DragonSlayingStrategy
|
2016-08-30 13:29:12 +02:00
|
|
|
@enduml
|