标签:des http io os java ar 2014 sp on

package com.wangbiao.design.facade;
/**
*
* @Title: Client.java
* @Package com.wangbiao.design.facade
* @Description: TODO
* @author wangbiao
* @date 2014-9-20 下午03:56:08
* @version V1.0
*/
public class Client {
public static void main(String[] args) {
Facade facade = new Facade();
facade.methodA();
facade.methodB();
}
}
package com.wangbiao.design.facade;
/**
*
* @Title: Facade.java
* @Package com.wangbiao.design.facade
* @Description: Design Pattern-Facade
* @author wangbiao
* @date 2014-9-20 下午03:54:02
* @version V1.0
*/
public class Facade {
private SubSystemOne one;
private SubSystemTwo two;
private SubSystemThree three;
private SubSystemFour four;
public Facade() {
//init
one = new SubSystemOne();
two = new SubSystemTwo();
three = new SubSystemThree();
four = new SubSystemFour();
}
public void methodA(){
// one,two,three
one.methodOne();
two.methodTwo();
three.methodThree();
}
public void methodB(){
// four,three
three.methodThree();
four.methodFour();
}
}
class SubSystemOne{
public void methodOne(){
System.out.println("SubSystemOne");
}
}
class SubSystemTwo{
public void methodTwo(){
System.out.println("SubSystemTwo");
}
}
class SubSystemThree{
public void methodThree(){
System.out.println("SubSystemThree");
}
}
class SubSystemFour{
public void methodFour(){
System.out.println("SubSystemFour");
}
}
标签:des http io os java ar 2014 sp on
原文地址:http://my.oschina.net/u/617909/blog/316496