36 lines
1.4 KiB
D
36 lines
1.4 KiB
D
module command.remoteundostatus.app;
|
|
|
|
import command.remoteundostatus.remotecontrol;
|
|
import command.remoteundostatus.lightoncommand;
|
|
import command.remoteundostatus.lightoffcommand;
|
|
import command.remoteundostatus.light;
|
|
import command.remoteundostatus.ceilingfan;
|
|
import command.remoteundostatus.ceilingfanoffcommand;
|
|
import command.remoteundostatus.ceilingfanhighcommand;
|
|
import command.remoteundostatus.ceilingfanmediumcommand;
|
|
import command.remoteundostatus.ceilingfanlowcommand;
|
|
import command.remoteundostatus.garagedoorupcommand;
|
|
import command.remoteundostatus.garagedoordowncommand;
|
|
import command.remoteundostatus.garagedoor;
|
|
import command.remoteundostatus.stereoonwithcdcommand;
|
|
import command.remoteundostatus.stereo;
|
|
import command.remoteundostatus.stereooffcommand;
|
|
import std.stdio : writeln;
|
|
|
|
void main()
|
|
{
|
|
auto remoteControl = new RemoteControl();
|
|
|
|
auto ceilingFan = new CeilingFan("Living Room");
|
|
|
|
remoteControl.setCommand(0, new CeilingFanMediumCommand(ceilingFan), new CeilingFanOffCommand(ceilingFan));
|
|
remoteControl.setCommand(1, new CeilingFanHighCommand(ceilingFan), new CeilingFanOffCommand(ceilingFan));
|
|
|
|
remoteControl.onButtonWasPushed(0);
|
|
remoteControl.offButtonWasPushed(0);
|
|
writeln(remoteControl);
|
|
remoteControl.undoButtonWasPushed();
|
|
remoteControl.onButtonWasPushed(1);
|
|
writeln(remoteControl);
|
|
remoteControl.undoButtonWasPushed();
|
|
} |