Created
September 25, 2019 18:41
-
-
Save eirikb/2c52b6d1ff5f1dfa90876e9d93a2e3bf to your computer and use it in GitHub Desktop.
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
import no.eirikb.gutsu.Gutsu | |
class DataDesk { | |
fun sendMessage(text: String) { | |
println("${hashCode()}: Sending message: $text") | |
} | |
} | |
class PumpView(private val pumpService: PumpService) { | |
init { | |
clickPumpStart() | |
} | |
fun updateLabel(text: String) { | |
println("Update label: $text") | |
} | |
private fun clickPumpStart() { | |
pumpService.startPump() | |
} | |
} | |
class ThrusterPanel(pumpView: PumpView) | |
class MainPanel(thrustPanel: ThrusterPanel) | |
class PumpService(private val dataDesk: DataDesk) { | |
fun startPump() { | |
dataDesk.sendMessage("PUMP_START") | |
} | |
} | |
class PumpController(dataDesk: DataDesk, view: PumpView) { | |
init { | |
view.updateLabel("Hello from controller") | |
println("Data desk id in controller: ${dataDesk.hashCode()}") | |
} | |
} | |
class App(mainPanel: MainPanel, dataDesk: DataDesk, controller: PumpController) | |
fun main() { | |
val gutsu = Gutsu() | |
gutsu.getInstance(App::class.java) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment