mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-20 01:25:41 +00:00
32 lines
792 B
Plaintext
32 lines
792 B
Plaintext
@startuml
|
|
package com.iluwatar.bloc {
|
|
class Bloc {
|
|
- currentState : State
|
|
- listeners : List<StateListener<State>>
|
|
+ Bloc()
|
|
+ addListener(listener : StateListener<State>)
|
|
+ decrement()
|
|
- emitState(newState : State)
|
|
+ getListeners() : List<StateListener<State>>
|
|
+ increment()
|
|
+ removeListener(listener : StateListener<State>)
|
|
}
|
|
class BlocUi {
|
|
+ BlocUi()
|
|
+ createAndShowUi()
|
|
}
|
|
interface ListenerManager<T> {
|
|
+ addListener(StateListener<T>) {abstract}
|
|
+ getListeners() : List<StateListener<T>> {abstract}
|
|
+ removeListener(StateListener<T>) {abstract}
|
|
}
|
|
class Main {
|
|
+ Main()
|
|
+ main(args : String[]) {static}
|
|
}
|
|
interface StateListener<T> {
|
|
+ onStateChange(T) {abstract}
|
|
}
|
|
}
|
|
Bloc ..|> ListenerManager
|
|
@enduml |