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

commonMain.it.unibo.tuprolog.dsl.solve.PrologScopeWithResolution.kt Maven / Gradle / Ivy

Go to download

Kotlin DSL for logic programming, enriched with unification, clause storage, and resolution facilities

There is a newer version: 1.0.4
Show newest version
package it.unibo.tuprolog.dsl.solve

import it.unibo.tuprolog.core.Clause
import it.unibo.tuprolog.dsl.theory.PrologScopeWithTheories
import it.unibo.tuprolog.solve.MutableSolver
import it.unibo.tuprolog.solve.SolverFactory
import it.unibo.tuprolog.solve.channel.InputChannel
import it.unibo.tuprolog.solve.channel.OutputChannel
import it.unibo.tuprolog.solve.classic.ClassicSolverFactory
import it.unibo.tuprolog.solve.exception.Warning
import it.unibo.tuprolog.solve.flags.FlagStore
import it.unibo.tuprolog.solve.library.Libraries
import it.unibo.tuprolog.theory.Theory
import kotlin.js.JsName

interface PrologScopeWithResolution : PrologScopeWithTheories, MutableSolver {
    @JsName("solverFactory")
    val solverFactory: SolverFactory

    @JsName("defaultSolver")
    val defaultSolver: MutableSolver

    @JsName("solverOf")
    fun solverOf(
        otherLibraries: Libraries = solverFactory.defaultLibraries,
        flags: FlagStore = solverFactory.defaultFlags,
        staticKb: Theory = solverFactory.defaultStaticKb,
        dynamicKb: Theory = solverFactory.defaultDynamicKb,
        stdIn: InputChannel = solverFactory.defaultInputChannel,
        stdOut: OutputChannel = solverFactory.defaultOutputChannel,
        stdErr: OutputChannel = solverFactory.defaultErrorChannel,
        warnings: OutputChannel = solverFactory.defaultWarningsChannel
    ): MutableSolver = solverFactory.mutableSolverWithDefaultBuiltins(
        otherLibraries,
        flags,
        staticKb,
        dynamicKb,
        stdIn,
        stdOut,
        stdErr,
        warnings
    )

    @JsName("staticKbByArray")
    fun staticKb(vararg clauses: Clause) = loadStaticClauses(*clauses)

    @JsName("staticKbByIterable")
    fun staticKb(clauses: Iterable) = loadStaticClauses(clauses)

    @JsName("staticKbBySequence")
    fun staticKb(clauses: Sequence) = loadStaticClauses(clauses)

    @JsName("staticKbByTheory")
    fun staticKb(theory: Theory) = loadStaticKb(theory)

    @JsName("dynamicKbByArray")
    fun dynamicKb(vararg clauses: Clause) = loadDynamicClauses(*clauses)

    @JsName("dynamicKbByIterable")
    fun dynamicKb(clauses: Iterable) = loadDynamicClauses(clauses)

    @JsName("dynamicKbBySequence")
    fun dynamicKb(clauses: Sequence) = loadDynamicClauses(clauses)

    @JsName("dynamicKbByTheory")
    fun dynamicKb(theory: Theory) = loadDynamicKb(theory)

    companion object {
        @JsName("of")
        fun of(solverFactory: SolverFactory): PrologScopeWithResolution = PrologScopeWithResolutionImpl(solverFactory)

        @JsName("empty")
        fun empty(): PrologScopeWithResolution = of(ClassicSolverFactory)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy