This commit is contained in:
InsanusMokrassar 2018-09-05 20:31:49 +08:00
parent 7e7d00881f
commit 4b534b6b16
5 changed files with 14 additions and 9 deletions

View File

@ -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()
}
}

View File

@ -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<Psychomatrix>
suspend fun calculate(date: DateTime): Deferred<Psychomatrix>
suspend fun calculate(date: Date): Deferred<Psychomatrix>

View File

@ -17,19 +17,21 @@ class MutablePsychomatrix(date: DateTime) : Psychomatrix(date) {
constructor(psychomatrix: Psychomatrix): this(psychomatrix.date)
val operationsHistory: List<Operation>
get() = mutableOperationsHistory
val operationsHistory: Deferred<List<Operation>>
get() = async {
mutableOperationsHistory
}
val availableOperations: Deferred<List<Operation>>
get() = async {
availableConverts.await().plus(availableInverts.await())
}
private val availableConverts: Deferred<List<Operation>>
val availableConverts: Deferred<List<Operation>>
get() = async {
availableConverts(mutableNumbers, mutableOperationsHistory)
}
private val availableInverts: Deferred<List<Operation>>
val availableInverts: Deferred<List<Operation>>
get() = async {
availableInverts(mutableNumbers, mutableOperationsHistory)
}

View File

@ -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<Psychomatrix>(SUBSCRIPTIONS_MEDIUM)
override suspend fun calculate(date: Long): Deferred<Psychomatrix> {

View File

@ -0,0 +1,4 @@
package com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters
interface PsychomatrixChangerPresenter {
}