All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.it.unibo.tuprolog.solve.function.FunctionWrapper.kt Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
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