码迷,mamicode.com
首页 >  
搜索关键字:lifting the stone    ( 411个结果
Java 实现状态(State)模式
/** * @author stone */ public class WindowState { private String stateValue; public WindowState(String stateValue) { this.stateValue = stateValue; } public String getStateValue() { retur...
分类:编程语言   时间:2014-10-14 00:46:17    阅读次数:217
Java 实现备忘录(Memento)模式
/** * 数据对象 * @author stone * */ public class DataState { private String action; public void setAction(String action) { this.action = action; } public String getAction() { return action;...
分类:编程语言   时间:2014-10-13 23:20:27    阅读次数:250
Java 实现责任链(Chain of Responsibility)模式
类图 /** * 抽象责任 * @author stone * */ public abstract class IFilter { private IFilter successor; public IFilter getSuccessor() { return successor; } public void setSuccessor(IFilter succ...
分类:编程语言   时间:2014-10-11 22:06:46    阅读次数:248
Java 实现迭代器(Iterator)模式
类图 /** * 自定义集合接口, 类似java.util.Collection * 用于数据存储 * @author stone * */ public interface ICollection { IIterator iterator(); //返回迭代器 void add(T t); T get(int index); } /** * 自定义迭代器接口 类...
分类:编程语言   时间:2014-10-11 15:17:15    阅读次数:172
Java 实现观察者(Observer)模式
1. Java自带的实现 类图 /** * 观察目标 继承自 java.util.Observable * @author stone * */ public class UpdateObservable extends Observable { private int data; public UpdateObservable(Observer observer)...
分类:编程语言   时间:2014-10-10 21:37:14    阅读次数:285
Java 实现策略(Strategy)模式
/** * 策略模式:针对同一命令(或行为),不同的策略做不同的动作 * 商品促销 * 本类为:收取现金的类 * * @author stone */ public interface ICashSuper { double acceptCash(double money); } /** * 正常收取现金 * @author stone * */ public ...
分类:编程语言   时间:2014-10-10 19:17:14    阅读次数:148
Java 实现模板方法(TemplateMethod)模式
类图 /** * 业务流程模板,提供基本框架 * @author stone * */ public abstract class BaseTemplate { public abstract void part1(); public abstract void part2(); public abstract void part3(); //这里为了严格实验结...
分类:编程语言   时间:2014-10-10 18:58:14    阅读次数:222
Java 实现享元(Flyweight)模式
/** * 字母 * @author stone * */ public class Letter { private String name; public Letter(String name) { this.name = name; } public String getName() { return name; } }/** * 一个产生字母对象的 享元工...
分类:编程语言   时间:2014-10-10 14:46:14    阅读次数:182
Java 实现组合(Composite)模式
类图 /** * 树 整体 * * @author stone * */ public class Tree { private TreeNode root; //根节点 public Tree(String name) { this.root = new TreeNode(name); } public TreeNode getRoot() { re...
分类:编程语言   时间:2014-10-09 21:08:25    阅读次数:213
Java 实现桥接(Bridge)模式
/** * 手机壳、套 * @author stone * */ public abstract class BaseCellphoneShell { public abstract void mapping();//对应匹配哪种手机 }/** * 手机,桥接了 手机壳BaseCellphoneShell * @author stone */ public abstract cla...
分类:编程语言   时间:2014-10-09 17:14:58    阅读次数:176
411条   上一页 1 ... 32 33 34 35 36 ... 42 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!