12.07.2015 Views

Podsumowanie wzorców projektowych GoF

Podsumowanie wzorców projektowych GoF

Podsumowanie wzorców projektowych GoF

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

String tempString = new String("A cup with ");if (facadeWater != null) {if (facadeWater.getWaterIsBoiling()) {tempString = (tempString + "boiling water ");} else {tempString = (tempString + "cold water ");}} else {tempString = (tempString + "no water ");}}if (facadeTeaBag != null) {tempString = (tempString + "and a tea bag");} else {tempString = (tempString + "and no tea bag");}return tempString;}}FacadeCuppaMakerpackage pk.dydakt.to.dp.s.gof.facade;public class FacadeCuppaMaker {boolean teaBagIsSteeped;public FacadeCuppaMaker() {System.out.println("FacadeCuppaMaker ready to make you a cuppa!");}}public FacadeTeaCup makeACuppa() {FacadeTeaCup cup = new FacadeTeaCup();FacadeTeaBag teaBag = new FacadeTeaBag();FacadeWater water = new FacadeWater();cup.addFacadeTeaBag(teaBag);water.boilFacadeWater();cup.addFacadeWater(water);cup.steepTeaBag();return cup;}Wyjcie na konsoli:FacadeCuppaMaker ready to make you a cuppa!behold the beautiful new tea cupbehold the lovely tea bagbehold the wonderous waterthe tea bag is in the tea cupwater is boilingthe water is in the tea cupthe tea is steeping in the cupA nice cuppa tea!40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!