001package headfirst.command.remote;
002
003public class RemoteLoader {
004
005        public static void main(String[] args) {
006                RemoteControl remoteControl = new RemoteControl();
007
008                Light livingRoomLight = new Light("Living Room");
009                Light kitchenLight = new Light("Kitchen");
010                CeilingFan ceilingFan= new CeilingFan("Living Room");
011                GarageDoor garageDoor = new GarageDoor("");
012                Stereo stereo = new Stereo("Living Room");
013
014                LightOnCommand livingRoomLightOn =
015                                new LightOnCommand(livingRoomLight);
016                LightOffCommand livingRoomLightOff =
017                                new LightOffCommand(livingRoomLight);
018                LightOnCommand kitchenLightOn =
019                                new LightOnCommand(kitchenLight);
020                LightOffCommand kitchenLightOff =
021                                new LightOffCommand(kitchenLight);
022
023                CeilingFanOnCommand ceilingFanOn =
024                                new CeilingFanOnCommand(ceilingFan);
025                CeilingFanOffCommand ceilingFanOff =
026                                new CeilingFanOffCommand(ceilingFan);
027
028                GarageDoorUpCommand garageDoorUp =
029                                new GarageDoorUpCommand(garageDoor);
030                GarageDoorDownCommand garageDoorDown =
031                                new GarageDoorDownCommand(garageDoor);
032
033                StereoOnWithCDCommand stereoOnWithCD =
034                                new StereoOnWithCDCommand(stereo);
035                StereoOffCommand  stereoOff =
036                                new StereoOffCommand(stereo);
037
038                remoteControl.setCommand(0, livingRoomLightOn, livingRoomLightOff);
039                remoteControl.setCommand(1, kitchenLightOn, kitchenLightOff);
040                remoteControl.setCommand(2, ceilingFanOn, ceilingFanOff);
041                remoteControl.setCommand(3, stereoOnWithCD, stereoOff);
042
043                System.out.println(remoteControl);
044
045                remoteControl.onButtonWasPushed(0);
046                remoteControl.offButtonWasPushed(0);
047                remoteControl.onButtonWasPushed(1);
048                remoteControl.offButtonWasPushed(1);
049                remoteControl.onButtonWasPushed(2);
050                remoteControl.offButtonWasPushed(2);
051                remoteControl.onButtonWasPushed(3);
052                remoteControl.offButtonWasPushed(3);
053        }
054}