Refactor: Rename isSearchApplicable to matches for clarity and consistency

This commit is contained in:
Nebojsa Vuksic 2025-08-01 13:00:03 +02:00
parent 8fe4926fb7
commit ef4e5c8c6c
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ import androidx.compose.runtime.Immutable
data class Location(val name: String, val country: String) : PreviewableItem, Searchable { data class Location(val name: String, val country: String) : PreviewableItem, Searchable {
val id: String = "$name, $country" val id: String = "$name, $country"
override fun isSearchApplicable(query: String): Boolean { override fun matches(query: String): Boolean {
val applicableCandidates = listOf( val applicableCandidates = listOf(
id, id,
name, name,

View File

@ -4,5 +4,5 @@ package org.jetbrains.plugins.template.weatherApp.model
* Represents an entity that can be filtered by a search query. * Represents an entity that can be filtered by a search query.
*/ */
interface Searchable { interface Searchable {
fun isSearchApplicable(query: String): Boolean fun matches(query: String): Boolean
} }

View File

@ -27,6 +27,6 @@ class LocationsProvider : SearchAutoCompletionItemProvider<Location> {
override fun provideSearchableItems(searchTerm: String): List<Location> { override fun provideSearchableItems(searchTerm: String): List<Location> {
return locationStateFlow return locationStateFlow
.value .value
.filter { it.isSearchApplicable(searchTerm) } .filter { it.matches(searchTerm) }
} }
} }