From ef4e5c8c6c4e55ff08508e2a26886514600aa5e6 Mon Sep 17 00:00:00 2001 From: Nebojsa Vuksic Date: Fri, 1 Aug 2025 13:00:03 +0200 Subject: [PATCH] Refactor: Rename `isSearchApplicable` to `matches` for clarity and consistency --- .../org/jetbrains/plugins/template/weatherApp/model/Location.kt | 2 +- .../jetbrains/plugins/template/weatherApp/model/Searchable.kt | 2 +- .../plugins/template/weatherApp/services/LocationsProvider.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Location.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Location.kt index d347bce..722bd70 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Location.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Location.kt @@ -13,7 +13,7 @@ import androidx.compose.runtime.Immutable data class Location(val name: String, val country: String) : PreviewableItem, Searchable { val id: String = "$name, $country" - override fun isSearchApplicable(query: String): Boolean { + override fun matches(query: String): Boolean { val applicableCandidates = listOf( id, name, diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Searchable.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Searchable.kt index 063f563..78b088b 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Searchable.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/model/Searchable.kt @@ -4,5 +4,5 @@ package org.jetbrains.plugins.template.weatherApp.model * Represents an entity that can be filtered by a search query. */ interface Searchable { - fun isSearchApplicable(query: String): Boolean + fun matches(query: String): Boolean } \ No newline at end of file diff --git a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/LocationsProvider.kt b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/LocationsProvider.kt index a73212d..699977f 100644 --- a/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/LocationsProvider.kt +++ b/src/main/kotlin/org/jetbrains/plugins/template/weatherApp/services/LocationsProvider.kt @@ -27,6 +27,6 @@ class LocationsProvider : SearchAutoCompletionItemProvider { override fun provideSearchableItems(searchTerm: String): List { return locationStateFlow .value - .filter { it.isSearchApplicable(searchTerm) } + .filter { it.matches(searchTerm) } } } \ No newline at end of file