001package headfirst.combining.observer;
002
003public class GooseAdapter implements Quackable {
004        Goose goose;
005        Observable observable;
006
007        public GooseAdapter(Goose goose) {
008                this.goose = goose;
009                observable = new Observable(this);
010        }
011
012        public void quack() {
013                goose.honk();
014                notifyObservers();
015        }
016
017        public void registerObserver(Observer observer) {
018                observable.registerObserver(observer);
019        }
020
021        public void notifyObservers() {
022                observable.notifyObservers();
023        }
024
025        public String toString() {
026                return "Goose pretending to be a Duck";
027        }
028}