001package headfirst.combining.adapter;
002
003public class DuckSimulator {
004        public static void main(String[] args) {
005                DuckSimulator simulator = new DuckSimulator();
006                simulator.simulate();
007        }
008
009        void simulate() {
010                Quackable mallardDuck = new MallardDuck();
011                Quackable redheadDuck = new RedheadDuck();
012                Quackable duckCall = new DuckCall();
013                Quackable rubberDuck = new RubberDuck();
014                Quackable gooseDuck = new GooseAdapter(new Goose());
015
016                System.out.println("\nDuck Simulator: With Goose Adapter");
017
018                simulate(mallardDuck);
019                simulate(redheadDuck);
020                simulate(duckCall);
021                simulate(rubberDuck);
022                simulate(gooseDuck);
023        }
024
025        void simulate(Quackable duck) {
026                duck.quack();
027        }
028}