This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/command/remoteundostatus/app.d

36 lines
1.4 KiB
D
Raw Normal View History

2022-11-15 19:39:18 +00:00
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();
}