Last active
June 19, 2020 19:01
-
-
Save sasssass/a8e1146c80aefa74f694e6b14284a2d9 to your computer and use it in GitHub Desktop.
ConcreteCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class LightCommandMother (var light: Light) : Command { | |
var lastStatus : Int = light.color | |
override fun undo() { | |
light.color = lastStatus | |
} | |
} | |
class LightBlueCommand (light: Light) : LightCommandMother(light) { | |
override fun execute() { | |
light.blue() | |
} | |
} | |
class LightWhiteCommand (light: Light) : LightCommandMother(light) { | |
override fun execute() { | |
light.white() | |
} | |
} | |
class LightRedCommand (light: Light) : LightCommandMother(light) { | |
override fun execute() { | |
light.red() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment