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 entitiesDI: EntitiesDI
) : UseCasesDI, EntitiesDI by entitiesDI { ) : UseCasesDI, EntitiesDI by entitiesDI {
val calculatePsychomatrixByDateUseCase: CalculatePsychomatrixByDateUseCase by lazy { override val calculatePsychomatrixByDateUseCase: CalculatePsychomatrixByDateUseCase by lazy {
CalculatePsychomatrixByDateUseCaseInteractor() CalculatePsychomatrixByDateUseCaseInteractor()
} }
} }

View File

@ -6,7 +6,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.* import java.util.*
interface CalculatePsychomatrixByDate { interface CalculatePsychomatrixByDateUseCase {
suspend fun calculate(date: Long): Deferred<Psychomatrix> suspend fun calculate(date: Long): Deferred<Psychomatrix>
suspend fun calculate(date: DateTime): Deferred<Psychomatrix> suspend fun calculate(date: DateTime): Deferred<Psychomatrix>
suspend fun calculate(date: Date): 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) constructor(psychomatrix: Psychomatrix): this(psychomatrix.date)
val operationsHistory: List<Operation> val operationsHistory: Deferred<List<Operation>>
get() = mutableOperationsHistory get() = async {
mutableOperationsHistory
}
val availableOperations: Deferred<List<Operation>> val availableOperations: Deferred<List<Operation>>
get() = async { get() = async {
availableConverts.await().plus(availableInverts.await()) availableConverts.await().plus(availableInverts.await())
} }
private val availableConverts: Deferred<List<Operation>> val availableConverts: Deferred<List<Operation>>
get() = async { get() = async {
availableConverts(mutableNumbers, mutableOperationsHistory) availableConverts(mutableNumbers, mutableOperationsHistory)
} }
private val availableInverts: Deferred<List<Operation>> val availableInverts: Deferred<List<Operation>>
get() = async { get() = async {
availableInverts(mutableNumbers, mutableOperationsHistory) availableInverts(mutableNumbers, mutableOperationsHistory)
} }

View File

@ -1,6 +1,6 @@
package com.github.insanusmokrassar.PsychomatrixBase.domain.interactors 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.domain.entities.Psychomatrix
import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.SUBSCRIPTIONS_MEDIUM import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.SUBSCRIPTIONS_MEDIUM
import kotlinx.coroutines.experimental.Deferred import kotlinx.coroutines.experimental.Deferred
@ -10,7 +10,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel
import org.joda.time.DateTime import org.joda.time.DateTime
import java.util.* import java.util.*
class CalculatePsychomatrixByDateInteractor : CalculatePsychomatrixByDate { class CalculatePsychomatrixByDateUseCaseInteractor : CalculatePsychomatrixByDateUseCase {
private val psychomatrixCreatedBroadcast = BroadcastChannel<Psychomatrix>(SUBSCRIPTIONS_MEDIUM) private val psychomatrixCreatedBroadcast = BroadcastChannel<Psychomatrix>(SUBSCRIPTIONS_MEDIUM)
override suspend fun calculate(date: Long): Deferred<Psychomatrix> { override suspend fun calculate(date: Long): Deferred<Psychomatrix> {

View File

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