Update visualization

This commit is contained in:
Alexander Nozik 2023-05-30 15:02:09 +03:00
parent 9c39f44897
commit 2191bb7a77

View File

@ -14,26 +14,24 @@ public interface DeviceHub : Provider {
override val defaultChainTarget: String get() = Device.DEVICE_TARGET
override fun content(target: String): Map<Name, Any> {
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<Name, Any> = 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