001package headfirst.command.party;
002
003public class RemoteLoader {
004
005        public static void main(String[] args) {
006
007                RemoteControl remoteControl = new RemoteControl();
008
009                Light light = new Light("Living Room");
010                TV tv = new TV("Living Room");
011                Stereo stereo = new Stereo("Living Room");
012                Hottub hottub = new Hottub();
013
014                LightOnCommand lightOn = new LightOnCommand(light);
015                StereoOnCommand stereoOn = new StereoOnCommand(stereo);
016                TVOnCommand tvOn = new TVOnCommand(tv);
017                HottubOnCommand hottubOn = new HottubOnCommand(hottub);
018                LightOffCommand lightOff = new LightOffCommand(light);
019                StereoOffCommand stereoOff = new StereoOffCommand(stereo);
020                TVOffCommand tvOff = new TVOffCommand(tv);
021                HottubOffCommand hottubOff = new HottubOffCommand(hottub);
022
023                Command[] partyOn = { lightOn, stereoOn, tvOn, hottubOn};
024                Command[] partyOff = { lightOff, stereoOff, tvOff, hottubOff};
025
026                MacroCommand partyOnMacro = new MacroCommand(partyOn);
027                MacroCommand partyOffMacro = new MacroCommand(partyOff);
028
029                remoteControl.setCommand(0, partyOnMacro, partyOffMacro);
030
031                System.out.println(remoteControl);
032                System.out.println("--- Pushing Macro On---");
033                remoteControl.onButtonWasPushed(0);
034                System.out.println("--- Pushing Macro Off---");
035                remoteControl.offButtonWasPushed(0);
036        }
037}