随笔分类 -  设计模式

摘要:1 package com.shejimoshi.behavioral.TemplateMethod; 2 3 4 /** 5 * 功能:抽象模板类 6 * 时间:2016年3月10日下午9:02:32 7 * 作者:cutter_point 8 */ 9 public abstract class 阅读全文
posted @ 2016-03-10 21:12 cutter_point 阅读(320) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Strategy; 2 3 4 /** 5 * 功能:上班的接口 6 * 时间:2016年3月9日下午8:53:34 7 * 作者:cutter_point 8 */ 9 public interface ToWork 10 { 阅读全文
posted @ 2016-03-09 21:54 cutter_point 阅读(430) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.State; 2 3 4 /** 5 * 功能:状态接口 6 * 时间:2016年3月8日下午9:41:17 7 * 作者:cutter_point 8 */ 9 public interface State 10 { 11 / 阅读全文
posted @ 2016-03-08 22:21 cutter_point 阅读(415) 评论(3) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Observer; 2 3 4 /** 5 * 功能:学生观察者 6 * 时间:2016年3月7日上午10:28:00 7 * 作者:cutter_point 8 */ 9 public interface Student 10 阅读全文
posted @ 2016-03-07 11:01 cutter_point 阅读(553) 评论(2) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Memento; 2 3 4 /** 5 * 功能:游戏角色 6 * 时间:2016年3月6日下午9:39:18 7 * 作者:cutter_point 8 */ 9 public class GameRole 10 { 11 阅读全文
posted @ 2016-03-06 22:23 cutter_point 阅读(493) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Mediator; 2 3 4 /** 5 * 功能:领导者接口 6 * 时间:2016年3月5日下午10:41:35 7 * 作者:cutter_point 8 */ 9 public interface Leader 10 阅读全文
posted @ 2016-03-05 23:30 cutter_point 阅读(320) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Iterator; 2 3 4 /** 5 * 功能:我们的迭代器接口 6 * 时间:2016年3月4日上午9:17:36 7 * 作者:cutter_point 8 */ 9 public interface MyIterat 阅读全文
posted @ 2016-03-04 09:35 cutter_point 阅读(281) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Interpreter; 2 3 4 /** 5 * 功能:演奏文本 6 * 时间:2016年3月3日上午9:26:19 7 * 作者:cutter_point 8 */ 9 public class PlayContext 1 阅读全文
posted @ 2016-03-03 10:06 cutter_point 阅读(224) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.Command; 2 3 4 /** 5 * 功能:接收命令着者,这个人可以执行多种命令 6 * 时间:2016年3月2日上午11:07:30 7 * 作者:cutter_point 8 */ 9 public class Re 阅读全文
posted @ 2016-03-02 14:00 cutter_point 阅读(527) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.behavioral.ChainOfResponsibility; 2 3 4 /** 5 * 功能:问题类型 6 * 时间:2016年3月1日上午9:59:18 7 * 作者:cutter_point 8 */ 9 public enum Ques 阅读全文
posted @ 2016-03-01 10:26 cutter_point 阅读(373) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.structural.Proxy; 2 3 4 /** 5 * 功能:为其他对象提供一种代理以控制这个对象的访问 6 * 适用:1、远程代理,为一个对象在不同的地址空间提供局部代表 7 * 2、虚代理,根据需要创建开销很大的对象 8 * 3、保护代理 阅读全文
posted @ 2016-02-29 10:34 cutter_point 阅读(339) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.structural.Flyweight; 2 3 4 /** 5 * 功能:运用共享技术有效地支持大量细粒度的对象,这个就是作为享元的类 6 * 适用:1、一个应用程序使用了大量的对象 7 * 2、完全由于使用大量的对象、造成很大的存储开销 8 * 阅读全文
posted @ 2016-02-27 22:49 cutter_point 阅读(300) 评论(0) 推荐(0)
摘要:外观模式就是把一堆子类,用一个外观类进行封装,然后把他们的功能总结起来,然后用外观类实现,用这封装使用频繁的方法 1 package com.shejimoshi.structural.Facade; 2 3 4 /** 5 * 功能:显示器类,作为子系统 6 * 时间:2016年2月26日下午12 阅读全文
posted @ 2016-02-26 12:28 cutter_point 阅读(278) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.structural.Decorator; 2 3 4 /** 5 * 功能:这个是我们装饰器的基类,用来生成被装饰类和装饰器类 6 * 时间:2016年2月25日上午10:05:37 7 * 作者:cutter_point 8 */ 9 publi 阅读全文
posted @ 2016-02-25 11:33 cutter_point 阅读(276) 评论(0) 推荐(0)
摘要:1 package com.shejimoshi.structural.Composite.type1; 2 3 4 /** 5 * 功能:将对象组合成树形结构以表示“部分-整体”的层次结构。composite使得用户对单个对象和组合对象的使用具有一致性 6 * 适用:想表示对象的部分-整体层次结构 阅读全文
posted @ 2016-02-20 21:29 cutter_point 阅读(277) 评论(0) 推荐(0)
摘要:桥接模式就是对一个类的方法进行抽象化,吧不相关的因素提取出来,发展出第二个类 1 package com.shejimoshi.structural.Bridge; 2 3 4 /** 5 * 功能:桥接模式使用 6 * 意图:将抽象部分与它的实现部分分离,使他们都可以独立的变化 7 * 适用性:你 阅读全文
posted @ 2016-02-17 20:27 cutter_point 阅读(330) 评论(0) 推荐(0)
摘要:抽象类 1 package com.shejimoshi.structural.Adapter; 2 3 4 /** 5 * 功能:适配器模式 6 * 将一个类的接口转换成客户希望的另外一个接口。adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作 7 * 适用性:你想使用一个 阅读全文
posted @ 2016-02-17 18:20 cutter_point 阅读(409) 评论(0) 推荐(0)
摘要:原始单例模式 1 package com.shejimoshi.create.Singleton; 2 3 4 /** 5 * 功能:保证一个类仅有一个实例,并提供一个访问它的全局访问点 6 * 适用:1、当类只能有一个实例而且客户可以从一个众所周知的访问点访问他的时候 7 * :2、当这个唯一实例 阅读全文
posted @ 2016-02-15 20:38 cutter_point 阅读(390) 评论(0) 推荐(0)
摘要:代码示例: 1 package com.shejimoshi.create.Prototype; 2 3 4 /** 5 * 功能:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象 6 * 适用:当一个系统应该独立于她得产品创建、构成和表示时,要使用Prototype模式 7 * 实例 阅读全文
posted @ 2016-02-14 19:46 cutter_point 阅读(273) 评论(0) 推荐(0)
摘要:模式结构: 实现: 1 package com.shejimoshi.create.FactoryMethod; 2 3 4 /** 5 * 功能:工厂方法模式 6 * 意图 : 7 * 定义一个用于创建对象的接口,让子类决定实例化哪一个类。 8 * 适用性: 9 * 当一个类不知道它所必须创建的对 阅读全文
posted @ 2016-02-13 16:34 cutter_point 阅读(304) 评论(0) 推荐(0)