From af207d78a4fde8bcd80ec0dfd50de259be439d1c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 14 Oct 2020 17:38:03 +0600 Subject: [PATCH] renames --- .../repos/{HashMapCRUDRepo.kt => MapCRUDRepo.kt} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/{HashMapCRUDRepo.kt => MapCRUDRepo.kt} (87%) diff --git a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/HashMapCRUDRepo.kt b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt similarity index 87% rename from repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/HashMapCRUDRepo.kt rename to repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt index 9815088d9ca..fcd14d7e3f4 100644 --- a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/HashMapCRUDRepo.kt +++ b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt @@ -4,7 +4,7 @@ import dev.inmo.micro_utils.coroutines.BroadcastFlow import dev.inmo.micro_utils.pagination.* import kotlinx.coroutines.flow.Flow -class MapCRUDRepo( +class ReadMapCRUDRepo( private val map: Map = emptyMap() ) : ReadStandardCRUDRepo { override suspend fun getByPagination(pagination: Pagination): PaginationResult { @@ -21,7 +21,7 @@ class MapCRUDRepo( override suspend fun contains(id: IdType): Boolean = map.containsKey(id) } -abstract class MutableMapCRUDRepo( +abstract class WriteMapCRUDRepo( private val map: MutableMap = mutableMapOf() ) : WriteStandardCRUDRepo { private val _newObjectsFlow: BroadcastFlow = BroadcastFlow() @@ -68,17 +68,17 @@ abstract class MutableMapCRUDRepo( } -abstract class HashMapCRUDRepo( +abstract class MapCRUDRepo( map: MutableMap ) : StandardCRUDRepo, - ReadStandardCRUDRepo by MapCRUDRepo(map), - MutableMapCRUDRepo(map) + ReadStandardCRUDRepo by ReadMapCRUDRepo(map), + WriteMapCRUDRepo(map) -fun HashMapCRUDRepo( +fun MapCRUDRepo( map: MutableMap, updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, createCallback: suspend (newValue: InputValueType) -> Pair -) = object : HashMapCRUDRepo(map) { +) = object : MapCRUDRepo(map) { override suspend fun updateObject( newValue: InputValueType, id: IdType,