View MusicPlayerFacade.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
class MusicPlayerFacade { | |
private val player = MediaPlayer() | |
private val playlist = Playlist() | |
fun play(song: Song) { | |
playlist.clear() | |
playlist.addSong(song) | |
player.reset() | |
player.setDataSource(song.filePath) | |
player.prepare() |
View Facade.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
class SubsystemA { | |
fun operationA() { | |
// implementation | |
} | |
} | |
class SubsystemB { | |
fun operationB() { | |
// implementation | |
} |
View Coffee.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
interface Coffee { | |
fun cost(): Double | |
fun ingredients(): String | |
} | |
class Espresso : Coffee { | |
override fun cost() = 2.0 | |
override fun ingredients() = "Espresso" | |
} |
View Decorator.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
interface Component { | |
fun operation() | |
} | |
class ConcreteComponent : Component { | |
override fun operation() { | |
// implementation | |
} | |
} |
View sdui.json
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
{ | |
"data": [ | |
{ | |
"type": "SCAFFOLD", | |
"top_bar": [ | |
{ | |
"type": "APP_BAR", | |
"children": [ | |
{ | |
"type": "EDIT_TEXT", |
View ViewComponent.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
interface ViewComponent { | |
fun draw() | |
} | |
class TextView : ViewComponent { | |
override fun draw() { | |
// Draw text view on screen | |
} | |
} |
View Composite.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
interface Component { | |
fun operation() | |
} | |
class Leaf : Component { | |
override fun operation() { | |
// implementation | |
} | |
} |
View NetworkAPI.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
interface NetworkAPI { | |
fun sendData(data: String) | |
} | |
class HTTPAPI : NetworkAPI { | |
override fun sendData(data: String) { | |
// send data over HTTP | |
} | |
} |
View Bridge2.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
interface Implementor { | |
fun operationImplementation() | |
} | |
class ConcreteImplementorA : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} |
View Bridge.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
interface Implementor { | |
fun operationImplementation() | |
} | |
class ConcreteImplementorA : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} |
NewerOlder