mirror of
https://github.com/InsanusMokrassar/PsychomatrixBase.git
synced 2024-11-14 20:33:57 +00:00
one more fix for operations
This commit is contained in:
parent
21729c4e64
commit
c40a4de99d
@ -1,7 +1,5 @@
|
|||||||
package com.github.insanusmokrassar.PsychomatrixBase.domain.entities.operations
|
package com.github.insanusmokrassar.PsychomatrixBase.domain.entities.operations
|
||||||
|
|
||||||
import java.io.IOException
|
|
||||||
|
|
||||||
private const val oneAsByte: Byte = 1
|
private const val oneAsByte: Byte = 1
|
||||||
private const val twoAsByte: Byte = 2
|
private const val twoAsByte: Byte = 2
|
||||||
private const val fourAsByte: Byte = 4
|
private const val fourAsByte: Byte = 4
|
||||||
@ -11,8 +9,6 @@ private const val sevenAsByte: Byte = 7
|
|||||||
private const val eightAsByte: Byte = 8
|
private const val eightAsByte: Byte = 8
|
||||||
private const val nineAsByte: Byte = 9
|
private const val nineAsByte: Byte = 9
|
||||||
|
|
||||||
class ConverterException: IOException("This converter can't convert input numbers")
|
|
||||||
|
|
||||||
val List<Operation>.canGrowSimpleWay: Boolean
|
val List<Operation>.canGrowSimpleWay: Boolean
|
||||||
get() = contains(SixGrowSeven)
|
get() = contains(SixGrowSeven)
|
||||||
|
|
||||||
@ -33,12 +29,12 @@ private val operations: List<Operation> = listOf(
|
|||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun availableConverts(numbers: MutableList<Byte>, operations: List<Operation>): List<Operation> {
|
suspend fun availableConverts(numbers: MutableList<Byte>, history: List<Operation>): List<Operation> {
|
||||||
return operations.filter { it.canConvert(numbers, operations) }
|
return operations.filter { it.canConvert(numbers, history) }
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun availableInverts(numbers: MutableList<Byte>, operations: List<Operation>): List<Operation> {
|
suspend fun availableInverts(numbers: MutableList<Byte>, history: List<Operation>): List<Operation> {
|
||||||
return operations.filter { it.canInvert(numbers, operations) }
|
return operations.filter { it.canInvert(numbers, history) }
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class Operation {
|
sealed class Operation {
|
||||||
|
Loading…
Reference in New Issue
Block a user