39 lines
817 B
Plaintext
Raw Permalink Normal View History

2019-12-07 18:03:49 +02:00
@startuml
package com.iluwatar.state {
class AngryState {
- LOGGER : Logger {static}
- mammoth : Mammoth
+ AngryState(mammoth : Mammoth)
+ observe()
+ onEnterState()
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Mammoth {
- state : State
+ Mammoth()
- changeStateTo(newState : State)
+ observe()
+ timePasses()
+ toString() : String
}
class PeacefulState {
- LOGGER : Logger {static}
- mammoth : Mammoth
+ PeacefulState(mammoth : Mammoth)
+ observe()
+ onEnterState()
}
interface State {
+ observe() {abstract}
+ onEnterState() {abstract}
}
}
PeacefulState --> "-mammoth" Mammoth
AngryState --> "-mammoth" Mammoth
Mammoth --> "-state" State
AngryState ..|> State
PeacefulState ..|> State
@enduml