42 lines
887 B
D
42 lines
887 B
D
|
module command.remoteundostatus.ceilingfanhighcommand;
|
||
|
|
||
|
import command.remoteundostatus.command;
|
||
|
import command.remoteundostatus.ceilingfan;
|
||
|
|
||
|
class CeilingFanHighCommand : Command
|
||
|
{
|
||
|
CeilingFan ceilingFan;
|
||
|
int prevSpeed;
|
||
|
|
||
|
this(CeilingFan ceilingFan)
|
||
|
{
|
||
|
this.ceilingFan = ceilingFan;
|
||
|
}
|
||
|
|
||
|
void execute()
|
||
|
{
|
||
|
prevSpeed = ceilingFan.getSpeed();
|
||
|
ceilingFan.high();
|
||
|
}
|
||
|
|
||
|
void undo()
|
||
|
{
|
||
|
switch (prevSpeed)
|
||
|
{
|
||
|
case CeilingFan.HIGH:
|
||
|
ceilingFan.high();
|
||
|
break;
|
||
|
case CeilingFan.MEDIUM:
|
||
|
ceilingFan.medium();
|
||
|
break;
|
||
|
case CeilingFan.LOW:
|
||
|
ceilingFan.low();
|
||
|
break;
|
||
|
case CeilingFan.OFF:
|
||
|
ceilingFan.off();
|
||
|
break;
|
||
|
default: break;
|
||
|
}
|
||
|
}
|
||
|
}
|