随笔分类 -  设计模式

摘要:结构图:实现: 1 class SubClass1 2 { 3 public void methodOne() 4 { 5 System.out.println("子系统方法一"); 6 } 7 } 8 9 class SubClass210 {11 ... 阅读全文
posted @ 2015-12-02 22:20 gatsbydhn 阅读(380) 评论(0) 推荐(0)
摘要:结构图:实现: 1 abstract class AbstractClass 2 { 3 abstract void primitiveOperation1(); //延迟到子类中实现 4 abstract void primitiveOperation2(); ... 阅读全文
posted @ 2015-12-01 22:47 gatsbydhn 阅读(234) 评论(0) 推荐(0)
摘要:结构图:实现:1 abstract public class Component {2 abstract public void operation();3 }public class ConcreteComponent extends Component { @Override ... 阅读全文
posted @ 2015-11-26 20:01 gatsbydhn 阅读(134) 评论(0) 推荐(0)
摘要:结构图:实现:1 abstract public class Strategy {2 public void algrithmInterface()3 { 4 }5 } 1 public class StrategyA extends Strategy{ 2 3 ... 阅读全文
posted @ 2015-11-26 19:27 gatsbydhn 阅读(144) 评论(0) 推荐(0)
摘要:类图:1 public interface IFactory {2 public Operation createOperation();3 }1 public class AddOperationFactory implements IFactory {2 3 @Override4... 阅读全文
posted @ 2015-11-25 21:08 gatsbydhn 阅读(120) 评论(0) 推荐(0)
摘要:类图:代码: 1 public class Operation { 2 3 protected double numberA = 0; 4 protected double numberB = 0; 5 6 7 public double getNumb... 阅读全文
posted @ 2015-11-25 20:37 gatsbydhn 阅读(179) 评论(0) 推荐(0)