mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 06:15:36 +00:00
* added bloC design pattern * added bloC design pattern * added Readme file * fixed checkstyle warnings * added tests for the ui * fixed a test in MainTest file * separating ui from main file and adding more tests * added pom.xml plugins and properties and fixed readme.md * fixed renaming problem and added context to main * chsnged state class to record * syncing changes for conflicts * Revert "fixed conflicts" * restored files * renamed readme file and abstracted pom file
This commit is contained in:
1 parent
3a1a71405b
commit
21115f4568
14 files changed
+733
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -0,0 +1,41 @@
|
||||
@startuml
|
||||
package com.iluwatar.bloc {
|
||||
|
||||
class State {
|
||||
- value : int
|
||||
+ State(value : int)
|
||||
+ getValue() : int
|
||||
}
|
||||
|
||||
interface StateListener<T> {
|
||||
+ onStateChange(state : T)
|
||||
}
|
||||
|
||||
interface ListenerManager<T> {
|
||||
+ addListener(listener : StateListener<T>)
|
||||
+ removeListener(listener : StateListener<T>)
|
||||
+ getListeners() : List<StateListener<T>>
|
||||
}
|
||||
|
||||
class BloC {
|
||||
- currentState : State
|
||||
- listeners : List<StateListener<State>>
|
||||
+ BloC()
|
||||
+ addListener(listener : StateListener<State>)
|
||||
+ removeListener(listener : StateListener<State>)
|
||||
+ getListeners() : List<StateListener<State>>
|
||||
- emitState(newState : State)
|
||||
+ increment()
|
||||
+ decrement()
|
||||
}
|
||||
|
||||
class Main {
|
||||
+ main(args : String[])
|
||||
}
|
||||
|
||||
ListenerManager <|.. BloC
|
||||
StateListener <|.. BloC
|
||||
BloC o-- State
|
||||
BloC *-- StateListener
|
||||
}
|
||||
@enduml
|
||||
Reference in new issue
Block a user