外观模式
//外观模式
//CopyRight(C)CAnca Software Office. 2006
//Created by CAnca.
public class FacadeMode{
public static void main(String[] args){
Facade f = new Facade();
f.MethodA();
f.MethodB();
}
}
//subSystem A
class FacadeA{
public void MethodA(){
System.out.println("This is the first Facade method.");
}
}
//subSystem B
class FacadeB{
public void MethodB(){
System.out.println("This is the second Facade method.");
}
}
//subSystem C
class FacadeC{
public void MethodC(){
System.out.println("This is the third Facade method.");
}
}
//subSystem D
class FacadeD{
public void MethodD(){
System.out.println("This is the fourth Facade method.");
}
}
class Facade{
private FacadeA fa;
private FacadeB fb;
private FacadeC fc;
private FacadeD fd;
public Facade(){
fa = new FacadeA();
fb = new FacadeB();
fc = new FacadeC();
fd = new FacadeD();
}
public void MethodA(){
fa.MethodA();
fb.MethodB();
fc.MethodC();
}
public void MethodB(){
fa.MethodA();
fd.MethodD();
}
}