2016-08-30 13:29:12 +02:00
|
|
|
@startuml
|
|
|
|
package com.iluwatar.state {
|
2016-11-26 12:51:06 +01:00
|
|
|
class AngryState {
|
|
|
|
- LOGGER : Logger {static}
|
2016-09-18 17:51:09 +03:00
|
|
|
- mammoth : Mammoth
|
2016-11-26 12:51:06 +01:00
|
|
|
+ AngryState(mammoth : Mammoth)
|
2016-09-18 17:51:09 +03:00
|
|
|
+ observe()
|
|
|
|
+ onEnterState()
|
|
|
|
}
|
|
|
|
class App {
|
|
|
|
+ App()
|
|
|
|
+ main(args : String[]) {static}
|
|
|
|
}
|
2016-08-30 13:29:12 +02:00
|
|
|
class Mammoth {
|
|
|
|
- state : State
|
|
|
|
+ Mammoth()
|
|
|
|
- changeStateTo(newState : State)
|
|
|
|
+ observe()
|
|
|
|
+ timePasses()
|
|
|
|
+ toString() : String
|
|
|
|
}
|
2016-11-26 12:51:06 +01:00
|
|
|
class PeacefulState {
|
|
|
|
- LOGGER : Logger {static}
|
|
|
|
- mammoth : Mammoth
|
|
|
|
+ PeacefulState(mammoth : Mammoth)
|
|
|
|
+ observe()
|
|
|
|
+ onEnterState()
|
|
|
|
}
|
|
|
|
interface State {
|
|
|
|
+ observe() {abstract}
|
|
|
|
+ onEnterState() {abstract}
|
|
|
|
}
|
2016-08-30 13:29:12 +02:00
|
|
|
}
|
2016-09-18 17:51:09 +03:00
|
|
|
PeacefulState --> "-mammoth" Mammoth
|
2017-02-11 21:46:56 +02:00
|
|
|
AngryState --> "-mammoth" Mammoth
|
2016-08-30 13:29:12 +02:00
|
|
|
Mammoth --> "-state" State
|
2016-09-18 17:51:09 +03:00
|
|
|
AngryState ..|> State
|
2016-11-26 12:51:06 +01:00
|
|
|
PeacefulState ..|> State
|
2016-08-30 13:29:12 +02:00
|
|
|
@enduml
|