-
-
Save kamilolesiejuk/938878 to your computer and use it in GitHub Desktop.
Zoidberg action handling draft
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
trait AndroidDeviceAction | |
case class Install extends AndroidDeviceAction | |
case class Instrument(options:InstrumentOptions) extends AndroidDeviceAction | |
case class Monkey extends AndroidDeviceAction | |
case class MoneyScript(script:Script) extends AndroidDeviceAction | |
trait AndroidDevice extends Actor { | |
def receive = { | |
case Install => // install app | |
case Instrument => | |
case Monkey => | |
case MoneyScript(s) => | |
} | |
} | |
// afterwards: | |
val aDevice = new Device() with AndroidDevice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you actually want
case MonkeyScript(s) => exectuteMonkey(s) with s begin the script like in http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html
When you do a case statement, the variable passed within the case class (i.e. the s for the above) will automatically be mapped depending on what receive gets. So in this case will try to map s to a class of type Script and inject it into the following closure (after =>)