Fill in the lack of documentation of kmath-ast module for adv-expr #109

Merged
CommanderTvis merged 3 commits from adv-expr-more-docs into adv-expr 2020-06-19 21:16:43 +03:00
2 changed files with 14 additions and 1 deletions
Showing only changes of commit ba499da2da - Show all commits

View File

@ -3,6 +3,13 @@ package scientifik.kmath.asm.internal
import scientifik.kmath.expressions.Expression import scientifik.kmath.expressions.Expression
import scientifik.kmath.operations.Algebra import scientifik.kmath.operations.Algebra
/**
* [Expression] partial implementation to have it subclassed by actual implementations. Provides unified storage for
* objects needed to implement the expression.
*
* @property algebra the algebra to delegate calls.
* @property constants the constants array to have persistent objects to reference in [invoke].
*/
internal abstract class AsmCompiledExpression<T> internal constructor( internal abstract class AsmCompiledExpression<T> internal constructor(
@JvmField protected val algebra: Algebra<T>, @JvmField protected val algebra: Algebra<T>,
@JvmField protected val constants: Array<Any> @JvmField protected val constants: Array<Any>

View File

@ -2,7 +2,13 @@ package scientifik.kmath.asm.internal
import scientifik.kmath.ast.MST import scientifik.kmath.ast.MST
internal fun buildName(mst: MST, collision: Int = 0): String { /**
* Creates a class name for [AsmCompiledExpression] subclassed to implement [mst] provided.
*
* This methods helps to avoid collisions of class name to prevent loading several classes with the same name. If there
* is a colliding class, change [collision] parameter or leave it `0` to check existing classes recursively.
*/
internal tailrec fun buildName(mst: MST, collision: Int = 0): String {
val name = "scientifik.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision" val name = "scientifik.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision"
try { try {