Podsumowanie wzorców projektowych GoF
Podsumowanie wzorców projektowych GoF
Podsumowanie wzorców projektowych GoF
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
}}new DvdRelease("DVDHBOSOPRAS2","The Sopranos Season 2",2001, 11, 6);DvdRelease xfilS5 =new DvdRelease("DVDFOXXFILES5","The X-Files Season 5",2002, 04, 1);btvs.newDvdRelease(btvsS2);simpsons.newDvdRelease(simpS2);sopranos.newDvdRelease(soprS2);xfiles.newDvdRelease(xfilS5);xfiles.removeSubscriber(wrosen);xfilS5.updateDvdReleaseDate(2002, 5, 14);xfiles.updateDvd(xfilS5);Klasy wzorca:DvdSubscriberpackage pk.dydakt.to.dp.b.gof.observer;public class DvdSubscriber {private String subscriberName;public DvdSubscriber(String subscriberNameIn) {this.subscriberName = subscriberNameIn;}public String getSubscriberName() {return this.subscriberName;}public void newDvdRelease(DvdRelease newDvdRelease,String subscriptionListName) {System.out.println("");System.out.println("Hello " + this.getSubscriberName() +", subscriber to the " +subscriptionListName +" DVD release list.");System.out.println("The new Dvd " +newDvdRelease.getDvdName() +" will be released on " +newDvdRelease.getDvdReleaseMonth() + "/" +newDvdRelease.getDvdReleaseDay() + "/" +newDvdRelease.getDvdReleaseYear() + ".");}public void updateDvdRelease(DvdRelease newDvdRelease,String subscriptionListName) {System.out.println("");System.out.println("Hello " + this.getSubscriberName() +", subscriber to the " +subscriptionListName +" DVD release list.");System.out.println("The following DVDs release has been revised: " +newDvdRelease.getDvdName() + " will be released on " +newDvdRelease.getDvdReleaseMonth() + "/" +48