From 4b534b6b163a4fc9034b0bf3986d1a6bf1ee44b5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 5 Sep 2018 20:31:49 +0800 Subject: [PATCH] fixes --- .../PsychomatrixBase/di/realisations/UseCasesDIImpl.kt | 3 +-- .../UseCases/CalculatePsychomatrixByDateUseCase.kt | 2 +- .../domain/entities/MutablePsychomatrix.kt | 10 ++++++---- .../CalculatePsychomatrixByDateUseCaseInteractor.kt | 4 ++-- .../presenters/PsychomatrixChangerPresenter.kt | 4 ++++ 5 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/PsychomatrixChangerPresenter.kt diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt index 4e9ebde..6052d13 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt @@ -9,8 +9,7 @@ open class UseCasesDIImpl( entitiesDI: EntitiesDI ) : UseCasesDI, EntitiesDI by entitiesDI { - val calculatePsychomatrixByDateUseCase: CalculatePsychomatrixByDateUseCase by lazy { + override val calculatePsychomatrixByDateUseCase: CalculatePsychomatrixByDateUseCase by lazy { CalculatePsychomatrixByDateUseCaseInteractor() } - } diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDateUseCase.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDateUseCase.kt index 588bcc5..be7f5bc 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDateUseCase.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDateUseCase.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel import org.joda.time.DateTime import java.util.* -interface CalculatePsychomatrixByDate { +interface CalculatePsychomatrixByDateUseCase { suspend fun calculate(date: Long): Deferred suspend fun calculate(date: DateTime): Deferred suspend fun calculate(date: Date): Deferred diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/MutablePsychomatrix.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/MutablePsychomatrix.kt index 3c446dd..ad5842b 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/MutablePsychomatrix.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/MutablePsychomatrix.kt @@ -17,19 +17,21 @@ class MutablePsychomatrix(date: DateTime) : Psychomatrix(date) { constructor(psychomatrix: Psychomatrix): this(psychomatrix.date) - val operationsHistory: List - get() = mutableOperationsHistory + val operationsHistory: Deferred> + get() = async { + mutableOperationsHistory + } val availableOperations: Deferred> get() = async { availableConverts.await().plus(availableInverts.await()) } - private val availableConverts: Deferred> + val availableConverts: Deferred> get() = async { availableConverts(mutableNumbers, mutableOperationsHistory) } - private val availableInverts: Deferred> + val availableInverts: Deferred> get() = async { availableInverts(mutableNumbers, mutableOperationsHistory) } diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateUseCaseInteractor.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateUseCaseInteractor.kt index 8efca8d..3c14b89 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateUseCaseInteractor.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateUseCaseInteractor.kt @@ -1,6 +1,6 @@ package com.github.insanusmokrassar.PsychomatrixBase.domain.interactors -import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDate +import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDateUseCase import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.Psychomatrix import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.SUBSCRIPTIONS_MEDIUM import kotlinx.coroutines.experimental.Deferred @@ -10,7 +10,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel import org.joda.time.DateTime import java.util.* -class CalculatePsychomatrixByDateInteractor : CalculatePsychomatrixByDate { +class CalculatePsychomatrixByDateUseCaseInteractor : CalculatePsychomatrixByDateUseCase { private val psychomatrixCreatedBroadcast = BroadcastChannel(SUBSCRIPTIONS_MEDIUM) override suspend fun calculate(date: Long): Deferred { diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/PsychomatrixChangerPresenter.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/PsychomatrixChangerPresenter.kt new file mode 100644 index 0000000..ec07809 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/PsychomatrixChangerPresenter.kt @@ -0,0 +1,4 @@ +package com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters + +interface PsychomatrixChangerPresenter { +} \ No newline at end of file