diff --git a/docs/notes/设计模式.md b/docs/notes/设计模式.md index f231d915..968a9a22 100644 --- a/docs/notes/设计模式.md +++ b/docs/notes/设计模式.md @@ -54,7 +54,7 @@ 私有构造函数保证了不能通过构造函数来创建对象实例,只能通过公有静态函数返回唯一的私有静态变量。 -

+

### Implementation @@ -255,7 +255,7 @@ secondName 这样做能把客户类和具体子类的实现解耦,客户类不再需要知道有哪些子类以及应当实例化哪个子类。客户类往往有多个,如果不使用简单工厂,那么所有的客户类都要知道所有子类的细节。而且一旦子类发生改变,例如增加子类,那么所有的客户类都要进行修改。 -

+

### Implementation @@ -338,7 +338,7 @@ public class Client { 下图中,Factory 有一个 doSomething() 方法,这个方法需要用到一个产品对象,这个产品对象由 factoryMethod() 方法创建。该方法是抽象的,需要由子类去实现。 -

+

### Implementation @@ -402,7 +402,7 @@ public class ConcreteFactory2 extends Factory { 从高层次来看,抽象工厂使用了组合,即 Cilent 组合了 AbstractFactory,而工厂方法模式使用了继承。 -

+

### Implementation @@ -492,7 +492,7 @@ public class Client { ### Class Diagram -

+

### Implementation @@ -582,7 +582,7 @@ abcdefghijklmnopqrstuvwxyz ### Class Diagram -

+

### Implementation @@ -643,7 +643,7 @@ abc - Handler:定义处理请求的接口,并且实现后继链(successor) -

+

### Implementation @@ -781,7 +781,7 @@ request2 is handle by ConcreteHandler2 - Invoker:通过它来调用命令 - Client:可以设置命令与命令的接收者 -

+

### Implementation @@ -902,7 +902,7 @@ public class Client { - TerminalExpression:终结符表达式,每个终结符都需要一个 TerminalExpression。 - Context:上下文,包含解释器之外的一些全局信息。 -

+

### Implementation @@ -1027,7 +1027,7 @@ false - Iterator 主要定义了 hasNext() 和 next() 方法。 - Client 组合了 Aggregate,为了迭代遍历 Aggregate,也需要组合 Iterator。 -

+

### Implementation @@ -1116,7 +1116,7 @@ public class Client { - Mediator:中介者,定义一个接口用于与各同事(Colleague)对象通信。 - Colleague:同事,相关对象 -

+

### Implementation @@ -1286,7 +1286,7 @@ doSprinkler() - Caretaker:负责保存好备忘录 - Menento:备忘录,存储原始对象的的状态。备忘录实际上有两个接口,一个是提供给 Caretaker 的窄接口:它只能将备忘录传递给其它对象;一个是提供给 Originator 的宽接口,允许它访问到先前状态所需的所有数据。理想情况是只允许 Originator 访问本备忘录的内部状态。 -

+

### Implementation @@ -1467,7 +1467,7 @@ public class Client { 观察者(Observer)的注册功能需要调用主题的 registerObserver() 方法。 -

+

### Implementation @@ -1594,7 +1594,7 @@ StatisticsDisplay.update: 1.0 1.0 1.0 ### Class Diagram -

+

### Implementation @@ -1901,7 +1901,7 @@ No gumball dispensed - Strategy 接口定义了一个算法族,它们都实现了 behavior() 方法。 - Context 是使用到该算法族的类,其中的 doSomething() 方法会调用 behavior(),setStrategy(Strategy) 方法可以动态地改变 strategy 对象,也就是说能动态地改变 Context 所使用的算法。 -

+

### 与状态模式的比较 @@ -1988,7 +1988,7 @@ quack! ### Class Diagram -

+

### Implementation @@ -2091,7 +2091,7 @@ Tea.addCondiments - ConcreteVisitor:具体访问者,存储遍历过程中的累计结果 - ObjectStructure:对象结构,可以是组合结构,或者是一个集合。 -

+

### Implementation @@ -2296,7 +2296,7 @@ Number of items: 6 ### Class Diagram -

+

### Implementation @@ -2352,7 +2352,7 @@ public class Client { ### Class Diagram -

+

### Implementation @@ -2424,7 +2424,7 @@ public class Client { - Abstraction:定义抽象类的接口 - Implementor:定义实现类接口 -

+

### Implementation @@ -2582,7 +2582,7 @@ public class Client { 组合对象拥有一个或者多个组件对象,因此组合对象的操作可以委托给组件对象去处理,而组件对象可以是另一个组合对象或者叶子对象。 -

+

### Implementation @@ -2714,7 +2714,7 @@ Composite:root 装饰者(Decorator)和具体组件(ConcreteComponent)都继承自组件(Component),具体组件的方法实现不需要依赖于其它对象,而装饰者组合了一个组件,这样它可以装饰其它装饰者或者具体组件。所谓装饰,就是把这个装饰者套在被装饰者之上,从而动态扩展被装饰者的功能。装饰者的方法有一部分是自己的,这属于它的功能,然后调用被装饰者的方法实现,从而也保留了被装饰者的功能。可以看到,具体组件应当是装饰层次的最低层,因为只有具体组件的方法实现不需要依赖于其它对象。 -

+

### Implementation @@ -2879,7 +2879,7 @@ public class Client { - IntrinsicState:内部状态,享元对象共享内部状态 - ExtrinsicState:外部状态,每个享元对象的外部状态不同 -

+

### Implementation @@ -2968,7 +2968,7 @@ Java 利用缓存来加速大量小对象的访问时间。 - 保护代理(Protection Proxy):按权限控制对象的访问,它负责检查调用者是否具有实现一个请求所必须的访问权限。 - 智能代理(Smart Reference):取代了简单的指针,它在访问对象时执行一些附加操作:记录对象的引用次数;当第一次引用一个对象时,将它装入内存;在访问一个实际对象前,检查是否已经锁定了它,以确保其它对象不能改变它。 -

+

### Implementation diff --git a/docs/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png b/docs/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png new file mode 100644 index 00000000..6cbae157 Binary files /dev/null and b/docs/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png differ diff --git a/docs/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png b/docs/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png new file mode 100644 index 00000000..7d765595 Binary files /dev/null and b/docs/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png differ diff --git a/docs/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png b/docs/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png new file mode 100644 index 00000000..e07b1812 Binary files /dev/null and b/docs/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png differ diff --git a/docs/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png b/docs/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png new file mode 100644 index 00000000..e5397988 Binary files /dev/null and b/docs/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png differ diff --git a/docs/pics/40c0c17e-bba6-4493-9857-147c0044a018.png b/docs/pics/40c0c17e-bba6-4493-9857-147c0044a018.png new file mode 100644 index 00000000..9182292c Binary files /dev/null and b/docs/pics/40c0c17e-bba6-4493-9857-147c0044a018.png differ diff --git a/docs/pics/50678f34-694f-45a4-91c6-34d985c83fee.png b/docs/pics/50678f34-694f-45a4-91c6-34d985c83fee.png new file mode 100644 index 00000000..3af4acb0 Binary files /dev/null and b/docs/pics/50678f34-694f-45a4-91c6-34d985c83fee.png differ diff --git a/docs/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png b/docs/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png new file mode 100644 index 00000000..72722db4 Binary files /dev/null and b/docs/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png differ diff --git a/docs/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png b/docs/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png new file mode 100644 index 00000000..05faa726 Binary files /dev/null and b/docs/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png differ diff --git a/docs/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png b/docs/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png new file mode 100644 index 00000000..cd072555 Binary files /dev/null and b/docs/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png differ diff --git a/docs/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png b/docs/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png new file mode 100644 index 00000000..2c8b681b Binary files /dev/null and b/docs/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png differ diff --git a/docs/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png b/docs/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png new file mode 100644 index 00000000..bb186222 Binary files /dev/null and b/docs/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png differ diff --git a/docs/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png b/docs/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png new file mode 100644 index 00000000..d361b7b3 Binary files /dev/null and b/docs/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png differ diff --git a/docs/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png b/docs/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png new file mode 100644 index 00000000..bd757f81 Binary files /dev/null and b/docs/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png differ diff --git a/docs/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png b/docs/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png new file mode 100644 index 00000000..3c05e805 Binary files /dev/null and b/docs/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png differ diff --git a/docs/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png b/docs/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png new file mode 100644 index 00000000..7ed8a50b Binary files /dev/null and b/docs/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png differ diff --git a/docs/pics/b8922f8c-95e6-4187-be85-572a509afb71.png b/docs/pics/b8922f8c-95e6-4187-be85-572a509afb71.png new file mode 100644 index 00000000..c70d6970 Binary files /dev/null and b/docs/pics/b8922f8c-95e6-4187-be85-572a509afb71.png differ diff --git a/docs/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png b/docs/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png new file mode 100644 index 00000000..200fa5d4 Binary files /dev/null and b/docs/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png differ diff --git a/docs/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png b/docs/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png new file mode 100644 index 00000000..95969741 Binary files /dev/null and b/docs/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png differ diff --git a/docs/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png b/docs/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png new file mode 100644 index 00000000..441597fb Binary files /dev/null and b/docs/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png differ diff --git a/docs/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png b/docs/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png new file mode 100644 index 00000000..0cf8929b Binary files /dev/null and b/docs/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png differ diff --git a/docs/pics/e2190c36-8b27-4690-bde5-9911020a1294.png b/docs/pics/e2190c36-8b27-4690-bde5-9911020a1294.png new file mode 100644 index 00000000..e0243d9c Binary files /dev/null and b/docs/pics/e2190c36-8b27-4690-bde5-9911020a1294.png differ diff --git a/docs/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png b/docs/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png new file mode 100644 index 00000000..ea25e3d8 Binary files /dev/null and b/docs/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png differ diff --git a/docs/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png b/docs/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png new file mode 100644 index 00000000..a40e2616 Binary files /dev/null and b/docs/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png differ diff --git a/docs/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png b/docs/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png new file mode 100644 index 00000000..31831acc Binary files /dev/null and b/docs/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png differ diff --git a/notes/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png b/notes/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png new file mode 100644 index 00000000..6cbae157 Binary files /dev/null and b/notes/pics/22870bbe-898f-4c17-a31a-d7c5ee5d1c10.png differ diff --git a/notes/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png b/notes/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png new file mode 100644 index 00000000..7d765595 Binary files /dev/null and b/notes/pics/2a1f8b0f-1dd7-4409-b177-a381c58066ad.png differ diff --git a/notes/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png b/notes/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png new file mode 100644 index 00000000..e07b1812 Binary files /dev/null and b/notes/pics/2b125bcd-1b36-43be-9b78-d90b076be549.png differ diff --git a/notes/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png b/notes/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png new file mode 100644 index 00000000..e5397988 Binary files /dev/null and b/notes/pics/30d6e95c-2e3c-4d32-bf4f-68128a70bc05.png differ diff --git a/notes/pics/40c0c17e-bba6-4493-9857-147c0044a018.png b/notes/pics/40c0c17e-bba6-4493-9857-147c0044a018.png new file mode 100644 index 00000000..9182292c Binary files /dev/null and b/notes/pics/40c0c17e-bba6-4493-9857-147c0044a018.png differ diff --git a/notes/pics/50678f34-694f-45a4-91c6-34d985c83fee.png b/notes/pics/50678f34-694f-45a4-91c6-34d985c83fee.png new file mode 100644 index 00000000..3af4acb0 Binary files /dev/null and b/notes/pics/50678f34-694f-45a4-91c6-34d985c83fee.png differ diff --git a/notes/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png b/notes/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png new file mode 100644 index 00000000..72722db4 Binary files /dev/null and b/notes/pics/5f5c22d5-9c0e-49e1-b5b0-6cc7032724d4.png differ diff --git a/notes/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png b/notes/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png new file mode 100644 index 00000000..05faa726 Binary files /dev/null and b/notes/pics/6b833bc2-517a-4270-8a5e-0a5f6df8cd96.png differ diff --git a/notes/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png b/notes/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png new file mode 100644 index 00000000..cd072555 Binary files /dev/null and b/notes/pics/79c6f036-bde6-4393-85a3-ef36a0327bd2.png differ diff --git a/notes/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png b/notes/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png new file mode 100644 index 00000000..2c8b681b Binary files /dev/null and b/notes/pics/79df886f-fdc3-4020-a07f-c991bb58e0d8.png differ diff --git a/notes/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png b/notes/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png new file mode 100644 index 00000000..bb186222 Binary files /dev/null and b/notes/pics/89292ae1-5f13-44dc-b508-3f035e80bf89.png differ diff --git a/notes/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png b/notes/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png new file mode 100644 index 00000000..d361b7b3 Binary files /dev/null and b/notes/pics/9b679ff5-94c6-48a7-b9b7-2ea868e828ed.png differ diff --git a/notes/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png b/notes/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png new file mode 100644 index 00000000..bd757f81 Binary files /dev/null and b/notes/pics/a8c8f894-a712-447c-9906-5caef6a016e3.png differ diff --git a/notes/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png b/notes/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png new file mode 100644 index 00000000..3c05e805 Binary files /dev/null and b/notes/pics/ac6a794b-68c0-486c-902f-8d988eee5766.png differ diff --git a/notes/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png b/notes/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png new file mode 100644 index 00000000..7ed8a50b Binary files /dev/null and b/notes/pics/b25e75a5-7aa4-42f8-b2f8-d5f81c4fb2fc.png differ diff --git a/notes/pics/b8922f8c-95e6-4187-be85-572a509afb71.png b/notes/pics/b8922f8c-95e6-4187-be85-572a509afb71.png new file mode 100644 index 00000000..c70d6970 Binary files /dev/null and b/notes/pics/b8922f8c-95e6-4187-be85-572a509afb71.png differ diff --git a/notes/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png b/notes/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png new file mode 100644 index 00000000..200fa5d4 Binary files /dev/null and b/notes/pics/c44a0342-f405-4f17-b750-e27cf4aadde2.png differ diff --git a/notes/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png b/notes/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png new file mode 100644 index 00000000..95969741 Binary files /dev/null and b/notes/pics/ca9f23bf-55a4-47b2-9534-a28e35397988.png differ diff --git a/notes/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png b/notes/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png new file mode 100644 index 00000000..441597fb Binary files /dev/null and b/notes/pics/cd1be8c2-755a-4a66-ad92-2e30f8f47922.png differ diff --git a/notes/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png b/notes/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png new file mode 100644 index 00000000..0cf8929b Binary files /dev/null and b/notes/pics/db5e376d-0b3e-490e-a43a-3231914b6668.png differ diff --git a/notes/pics/e2190c36-8b27-4690-bde5-9911020a1294.png b/notes/pics/e2190c36-8b27-4690-bde5-9911020a1294.png new file mode 100644 index 00000000..e0243d9c Binary files /dev/null and b/notes/pics/e2190c36-8b27-4690-bde5-9911020a1294.png differ diff --git a/notes/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png b/notes/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png new file mode 100644 index 00000000..ea25e3d8 Binary files /dev/null and b/notes/pics/eca1f422-8381-409b-ad04-98ef39ae38ba.png differ diff --git a/notes/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png b/notes/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png new file mode 100644 index 00000000..a40e2616 Binary files /dev/null and b/notes/pics/f4d0afd0-8e78-4914-9e60-4366eaf065b5.png differ diff --git a/notes/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png b/notes/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png new file mode 100644 index 00000000..31831acc Binary files /dev/null and b/notes/pics/ff5152fc-4ff3-44c4-95d6-1061002c364a.png differ diff --git a/notes/设计模式.md b/notes/设计模式.md index 73ddf8ae..b3d539c7 100644 --- a/notes/设计模式.md +++ b/notes/设计模式.md @@ -54,7 +54,7 @@ 私有构造函数保证了不能通过构造函数来创建对象实例,只能通过公有静态函数返回唯一的私有静态变量。 -

+

### Implementation @@ -255,7 +255,7 @@ secondName 这样做能把客户类和具体子类的实现解耦,客户类不再需要知道有哪些子类以及应当实例化哪个子类。客户类往往有多个,如果不使用简单工厂,那么所有的客户类都要知道所有子类的细节。而且一旦子类发生改变,例如增加子类,那么所有的客户类都要进行修改。 -

+

### Implementation @@ -338,7 +338,7 @@ public class Client { 下图中,Factory 有一个 doSomething() 方法,这个方法需要用到一个产品对象,这个产品对象由 factoryMethod() 方法创建。该方法是抽象的,需要由子类去实现。 -

+

### Implementation @@ -402,7 +402,7 @@ public class ConcreteFactory2 extends Factory { 从高层次来看,抽象工厂使用了组合,即 Cilent 组合了 AbstractFactory,而工厂方法模式使用了继承。 -

+

### Implementation @@ -492,7 +492,7 @@ public class Client { ### Class Diagram -

+

### Implementation @@ -582,7 +582,7 @@ abcdefghijklmnopqrstuvwxyz ### Class Diagram -

+

### Implementation @@ -643,7 +643,7 @@ abc - Handler:定义处理请求的接口,并且实现后继链(successor) -

+

### Implementation @@ -781,7 +781,7 @@ request2 is handle by ConcreteHandler2 - Invoker:通过它来调用命令 - Client:可以设置命令与命令的接收者 -

+

### Implementation @@ -902,7 +902,7 @@ public class Client { - TerminalExpression:终结符表达式,每个终结符都需要一个 TerminalExpression。 - Context:上下文,包含解释器之外的一些全局信息。 -

+

### Implementation @@ -1027,7 +1027,7 @@ false - Iterator 主要定义了 hasNext() 和 next() 方法。 - Client 组合了 Aggregate,为了迭代遍历 Aggregate,也需要组合 Iterator。 -

+

### Implementation @@ -1116,7 +1116,7 @@ public class Client { - Mediator:中介者,定义一个接口用于与各同事(Colleague)对象通信。 - Colleague:同事,相关对象 -

+

### Implementation @@ -1286,7 +1286,7 @@ doSprinkler() - Caretaker:负责保存好备忘录 - Menento:备忘录,存储原始对象的的状态。备忘录实际上有两个接口,一个是提供给 Caretaker 的窄接口:它只能将备忘录传递给其它对象;一个是提供给 Originator 的宽接口,允许它访问到先前状态所需的所有数据。理想情况是只允许 Originator 访问本备忘录的内部状态。 -

+

### Implementation @@ -1467,7 +1467,7 @@ public class Client { 观察者(Observer)的注册功能需要调用主题的 registerObserver() 方法。 -

+

### Implementation @@ -1594,7 +1594,7 @@ StatisticsDisplay.update: 1.0 1.0 1.0 ### Class Diagram -

+

### Implementation @@ -1901,7 +1901,7 @@ No gumball dispensed - Strategy 接口定义了一个算法族,它们都实现了 behavior() 方法。 - Context 是使用到该算法族的类,其中的 doSomething() 方法会调用 behavior(),setStrategy(Strategy) 方法可以动态地改变 strategy 对象,也就是说能动态地改变 Context 所使用的算法。 -

+

### 与状态模式的比较 @@ -1988,7 +1988,7 @@ quack! ### Class Diagram -

+

### Implementation @@ -2091,7 +2091,7 @@ Tea.addCondiments - ConcreteVisitor:具体访问者,存储遍历过程中的累计结果 - ObjectStructure:对象结构,可以是组合结构,或者是一个集合。 -

+

### Implementation @@ -2296,7 +2296,7 @@ Number of items: 6 ### Class Diagram -

+

### Implementation @@ -2352,7 +2352,7 @@ public class Client { ### Class Diagram -

+

### Implementation @@ -2424,7 +2424,7 @@ public class Client { - Abstraction:定义抽象类的接口 - Implementor:定义实现类接口 -

+

### Implementation @@ -2582,7 +2582,7 @@ public class Client { 组合对象拥有一个或者多个组件对象,因此组合对象的操作可以委托给组件对象去处理,而组件对象可以是另一个组合对象或者叶子对象。 -

+

### Implementation @@ -2714,7 +2714,7 @@ Composite:root 装饰者(Decorator)和具体组件(ConcreteComponent)都继承自组件(Component),具体组件的方法实现不需要依赖于其它对象,而装饰者组合了一个组件,这样它可以装饰其它装饰者或者具体组件。所谓装饰,就是把这个装饰者套在被装饰者之上,从而动态扩展被装饰者的功能。装饰者的方法有一部分是自己的,这属于它的功能,然后调用被装饰者的方法实现,从而也保留了被装饰者的功能。可以看到,具体组件应当是装饰层次的最低层,因为只有具体组件的方法实现不需要依赖于其它对象。 -

+

### Implementation @@ -2879,7 +2879,7 @@ public class Client { - IntrinsicState:内部状态,享元对象共享内部状态 - ExtrinsicState:外部状态,每个享元对象的外部状态不同 -

+

### Implementation @@ -2968,7 +2968,7 @@ Java 利用缓存来加速大量小对象的访问时间。 - 保护代理(Protection Proxy):按权限控制对象的访问,它负责检查调用者是否具有实现一个请求所必须的访问权限。 - 智能代理(Smart Reference):取代了简单的指针,它在访问对象时执行一些附加操作:记录对象的引用次数;当第一次引用一个对象时,将它装入内存;在访问一个实际对象前,检查是否已经锁定了它,以确保其它对象不能改变它。 -

+

### Implementation