From 499d369db32135ac4ed885d15a159dc8fdf8561a Mon Sep 17 00:00:00 2001 From: CyC2018 <1029579233@qq.com> Date: Tue, 5 Jun 2018 16:18:52 +0800 Subject: [PATCH] auto commit --- notes/设计模式.md | 198 +++++++++++++++++- pics/ec923dc7-864c-47b0-a411-1f2c48d084de.png | Bin 0 -> 27648 bytes 2 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 pics/ec923dc7-864c-47b0-a411-1f2c48d084de.png diff --git a/notes/设计模式.md b/notes/设计模式.md index 35bddad5..dc075cf7 100644 --- a/notes/设计模式.md +++ b/notes/设计模式.md @@ -2012,9 +2012,203 @@ Tea.addCondiments ### 意图 -提供便捷的维护方式来操作一组对象。它使你在不改变操作对象的前提下,可以修改或扩展对象的行为。 +为一个对象结构(比如组合结构)增加新能力。 -例如集合,它可以包含不同类型的元素,访问者模式允许在不知道具体元素类型的前提下对集合元素进行一些操作。 +### 类图 + +- Visitor:访问者,为每一个 ConcreteElement 声明一个 visit 操作 +- ConcreteVisitor:具体访问者,存储遍历过程中的累计结果 +- ObjectStructure:对象结构,可以是组合结构,或者是一个集合。 + +
3 zKX~l=hCo2$4cp@Q_Q}47TpzoeumaX`>gqRL?EYC8xP+rNCN?Mi;5*g*u8~-%P;j`35b-xi)L8ab zP7)ycVjiB)uWmXO^E8)FGJBej7rSI?TSBbFB|Jk7M~~y}hte|3rl(xsvPvoIHG>#} zT}d($D~yg6RV~W%&e=i{c~b%S+HO{$KojUe0&X+=A
7xl$L9EW0Ckzer)OIB-2K;kV{_QKPJ6abgXUd6 zS^b9~tg%Rr5c^p1KQC?CFIoi*zSsvD;X|5ux#H7iK*el;5p gW0Z7r0?Fd(_0Fnkln&M#Cz0mgp4RS)_t`n!rBB;RK10Dzurm>JnBU|HBGV z+q1nh%nj;Nt$MX D#U + e(Cns@qrf zUXb7tv*l$3_>gpH?wW)SMrHkpVDV3Ct;Rn2(MhyjL5QI?^|*E@(1H}QQzGfut|ItJ zJM;v1^v=SR8LLW+oe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