From 35793078fd3a775e771dcc86f52afb5a959be8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Hu=CC=88sers?= Date: Thu, 14 Mar 2024 13:38:13 +0100 Subject: [PATCH] chore: Simplify filter logic for VssNode.findSignal() --- .../main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt b/vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt index f0c6d0ad..b613f616 100644 --- a/vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt +++ b/vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt @@ -223,9 +223,8 @@ fun VssNode.findHeritageLine( /** * Finds the given [signal] inside the current [VssNode]. */ -inline fun , V : Any> VssNode.findSignal(signal: T): T { +inline fun , V : Any> VssNode.findSignal(signal: T): VssNode { return heritage - .filterIsInstance() .first { it.uuid == signal.uuid } } @@ -233,9 +232,8 @@ inline fun , V : Any> VssNode.findSignal(signal: T): T * Finds all [VssSignal] which matches the given [KClass.simpleName]. This is useful when multiple nested objects * with the same Name exists but are pretty much the same besides the [VssNode.vssPath] etc. */ -inline fun , V : Any> VssNode.findSignal(type: KClass): Map { +inline fun , V : Any> VssNode.findSignal(type: KClass): Map { return heritage - .filterIsInstance() .filter { it::class.simpleName == type.simpleName } .associateBy { it.vssPath } }