Minor refactor and encapsulation
This commit is contained in:
parent
36ad1fcf58
commit
fec8c7f9d1
@ -11,7 +11,7 @@ interface AsmExpression<T> {
|
||||
fun invoke(gen: AsmGenerationContext<T>)
|
||||
}
|
||||
|
||||
internal val methodNameAdapters = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
|
||||
private val methodNameAdapters: Map<String, String> = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
|
||||
|
||||
internal fun <T> hasSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
|
||||
val aName = methodNameAdapters[name] ?: name
|
||||
@ -137,7 +137,9 @@ internal class AsmConstProductExpression<T>(
|
||||
gen.visitAlgebraOperation(
|
||||
owner = AsmGenerationContext.SPACE_OPERATIONS_CLASS,
|
||||
method = "multiply",
|
||||
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.NUMBER_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};"
|
||||
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};" +
|
||||
"L${AsmGenerationContext.NUMBER_CLASS};)" +
|
||||
"L${AsmGenerationContext.OBJECT_CLASS};"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package scientifik.kmath.expressions
|
||||
|
||||
import scientifik.kmath.operations.*
|
||||
|
||||
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, val expr: Expression<T>) :
|
||||
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, private val expr: Expression<T>) :
|
||||
Expression<T> {
|
||||
override fun invoke(arguments: Map<String, T>): T = context.unaryOperation(name, expr.invoke(arguments))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user