mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-30 16:43:35 +00:00
Update 设计模式 - 中介者.md
重新绘制配图。
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
+2
-2
@@ -17,11 +17,11 @@
|
||||
|
||||
Alarm(闹钟)、CoffeePot(咖啡壶)、Calendar(日历)、Sprinkler(喷头)是一组相关的对象,在某个对象的事件产生时需要去操作其它对象,形成了下面这种依赖结构:
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/82cfda3b-b53b-4c89-9fdb-26dd2db0cd02.jpg"/> </div><br>
|
||||
<div align="center"> <img src="pics/mediator-before.png" width="640px"/> </div><br>
|
||||
|
||||
使用中介者模式可以将复杂的依赖结构变成星形结构:
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/5359cbf5-5a79-4874-9b17-f23c53c2cb80.jpg"/> </div><br>
|
||||
<div align="center"> <img src="pics/mediator-after.png" width="640px"/> </div><br>
|
||||
|
||||
```java
|
||||
public abstract class Colleague {
|
||||
|
||||
Reference in New Issue
Block a user