From 2191bb7a7783ba833d880c5012ea5f2eca01d5eb Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 30 May 2023 15:02:09 +0300 Subject: [PATCH] Update visualization --- .../space/kscience/controls/api/DeviceHub.kt | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceHub.kt b/controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceHub.kt index 9565950..8bd7452 100644 --- a/controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceHub.kt +++ b/controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceHub.kt @@ -14,26 +14,24 @@ public interface DeviceHub : Provider { override val defaultChainTarget: String get() = Device.DEVICE_TARGET - override fun content(target: String): Map { - if (target == Device.DEVICE_TARGET) { - return buildMap { - fun putAll(prefix: Name, hub: DeviceHub) { - hub.devices.forEach { - put(prefix + it.key, it.value) - } - } - - devices.forEach { - val name = it.key.asName() - put(name, it.value) - (it.value as? DeviceHub)?.let { hub -> - putAll(name, hub) - } + override fun content(target: String): Map = if (target == Device.DEVICE_TARGET) { + buildMap { + fun putAll(prefix: Name, hub: DeviceHub) { + hub.devices.forEach { + put(prefix + it.key, it.value) + } + } + + devices.forEach { + val name = it.key.asName() + put(name, it.value) + (it.value as? DeviceHub)?.let { hub -> + putAll(name, hub) } } - } else { - throw IllegalArgumentException("Target $target is not supported for $this") } + } else { + emptyMap() } public companion object