Created
March 27, 2020 11:20
-
-
Save IosephKnecht/5e023eda0c77a1b62e45d1d58bc75a4d to your computer and use it in GitHub Desktop.
HandBreadth Sample
This file contains hidden or 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
interface HandBreadthActionHandler { | |
fun littleFingerAction() | |
fun foreFingerAction() | |
fun middleFingerAction() | |
fun ringFingerAction() | |
fun thumbAction() | |
} | |
enum class HandBreadth(val action: Function1<HandBreadthActionHandler, Unit>) { | |
LITTLE_FINGER(action = HandBreadthActionHandler::littleFingerAction), | |
FORE_FINGER(action = HandBreadthActionHandler::foreFingerAction), | |
MIDDLE_FINGER(action = HandBreadthActionHandler::middleFingerAction), | |
RING_FINGER(action = HandBreadthActionHandler::ringFingerAction), | |
THUMB(action = HandBreadthActionHandler::thumbAction) | |
} | |
interface ControllerContract { | |
fun handleHandBreadthAction(handBreadth: HandBreadth) | |
} | |
internal class Controller : ControllerContract, HandBreadthActionHandler { | |
override fun littleFingerAction() = Unit | |
override fun foreFingerAction() = Unit | |
override fun middleFingerAction() = Unit | |
override fun ringFingerAction() = Unit | |
override fun thumbAction() = Unit | |
override fun handleHandBreadthAction(handBreadth: HandBreadth) { | |
handBreadth.action.invoke(this) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment