commonMain.it.unibo.tuprolog.solve.function.FunctionWrapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solve-jvm Show documentation
Show all versions of solve-jvm Show documentation
Resolution-agnostic API for logic solvers
package it.unibo.tuprolog.solve.function
import it.unibo.tuprolog.solve.AbstractWrapper
import it.unibo.tuprolog.solve.ExecutionContext
import it.unibo.tuprolog.solve.Signature
/**
* A class wrapping a [LogicFunction] implementation
*
* @author Enrico
*/
abstract class FunctionWrapper : AbstractWrapper {
constructor(signature: Signature) : super(signature)
constructor(name: String, arity: Int, vararg: Boolean = false) : super(name, arity, vararg)
/** The function expressing the implementation of the PrologFunction, without any check for application to correct signature */
protected abstract fun uncheckedImplementation(request: Compute.Request): Compute.Response
/** Checked PrologFunction implementation */
@Suppress("UNCHECKED_CAST")
final override val implementation: LogicFunction =
LogicFunction.enforcingSignature(signature, ::uncheckedImplementation)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy