
设计模式
ljz2016
这个作者很懒,什么都没留下…
展开
-
策略模式
策略模式适用于 : 一个类拥有几种固定方法,但是这些方法可能会有多种实现。比如:游戏的角色装备,装备属性是可以替换的。 一个类有多种算法,但是需要在多种之中动态的选择一种。 public class Person{ Wepean }原创 2017-08-02 00:02:17 · 192 阅读 · 0 评论 -
责任链模式
责任链模式原创 2017-07-31 20:59:48 · 201 阅读 · 1 评论 -
观察者模式
public class WeatherData extends Observable{ private float temperature; //温度 private float humidity; //湿度 private float pressure; //压强public WeatherData(){}/** *温度变化时调用 */ public void原创 2017-08-09 16:56:29 · 186 阅读 · 0 评论 -
装饰模式+工厂模式+模板模式
` public abstract class Pizza { String name; String dough;//面团 String sauce; Veggies[] veggies; Cheese cheese; Pepperoni pepperoni; Clams原创 2017-08-22 09:12:05 · 726 阅读 · 1 评论 -
命令模式
命令模式就是把方法调用封装起来,将动作请求者和动作实行者隔离开。public class RemoteControl { List<Command> onCommands; List<Command> offCommands; public RemoteControl(){ onCommands=new ArrayList<>(); offCo原创 2017-08-22 11:12:47 · 205 阅读 · 0 评论