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
{ | |
"todo_list": { | |
"type": "screen", | |
"children": [ | |
{ | |
"type": "text_field", | |
"key": "search_term", | |
"width": "match_parent", | |
"hint": "Search for stuff" | |
}, |
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 class Contention( | |
val selfBlock: Block, | |
val peersApexBlock: Block? | |
) |
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
val isConnected = bondSteadyState == PeripheralBond.State.CONNECTED | |
val hasPriority = priority != NO_PRIORITY | |
private val maxPossibleConnectionAndInteractiveScore = 4 + 2 | |
// Any device with a higher priority should always rank higher. | |
private val priorityScore = (maxPossibleConnectionAndInteractiveScore + 1.0).pow(priority) | |
private val connectionScore: Int get() { |
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 class Ledger( | |
val self: HostInfo, | |
val blocks: Set<Block> = emptySet() | |
) |
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 class Block( | |
val serviceClass: ServiceClass, | |
val profile: PeripheralProfile, | |
val peripheral: Peripheral, | |
val priority: Int, | |
val timestamp: Long, | |
val bondSteadyState: PeripheralBond.State, | |
val owner: HostInfo, | |
val canStreamData: Boolean, | |
val canHandleDataStream: Boolean |
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
internal interface MulticastChannel { | |
@Throws(Exception::class) | |
fun init(receiver: MessageReceiver) | |
@Throws(Exception::class) | |
fun send(message: ByteArray, size: Int) | |
fun close() | |
} |
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
object TimerResolution { | |
@JvmStatic | |
fun main(args: Array<String>) { | |
val numRepeat = 10 | |
var total = 0L | |
for(repeatIndex in 0 until numRepeat) { | |
val startTime = System.nanoTime() | |
var stopTime = System.nanoTime() |
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 kotlin.math.abs | |
typealias Duration = Long | |
typealias Sample = Long | |
object ThreadSleepStats { | |
@JvmStatic | |
fun main(args: Array<String>) { | |
val durations = listOf(1L, 10L, 100L, 1000L) |
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
// Example 1: Prints falsehoods at roughly 10 Hz | |
while(true) { | |
Thread.sleep(100) | |
println("Ronaldo is better than Messi") | |
} | |
// Example 2: Prints truism at roughly 1 KHz | |
while(true) { | |
Thread.sleep(1) | |
println("Human beings are great") |
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
@Serializable | |
class SessionPacket( | |
@ProtoId(1) | |
val payload: ByteArray, | |
@ProtoId(2) | |
val sequenceNumber: Int | |
) |
NewerOlder