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

commonMain.it.unibo.tuprolog.solve.sideffects.impl.DefaultSideEffectFactory.kt Maven / Gradle / Ivy

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

import it.unibo.tuprolog.core.Clause
import it.unibo.tuprolog.core.Term
import it.unibo.tuprolog.core.operators.Operator
import it.unibo.tuprolog.solve.channel.InputChannel
import it.unibo.tuprolog.solve.channel.OutputChannel
import it.unibo.tuprolog.solve.library.Library
import it.unibo.tuprolog.solve.library.Runtime
import it.unibo.tuprolog.solve.sideffects.SideEffect
import it.unibo.tuprolog.solve.sideffects.SideEffectFactory

internal object DefaultSideEffectFactory : SideEffectFactory {
    override fun resetStaticKb(clauses: Iterable) = SideEffect.ResetStaticKb(clauses)

    override fun resetStaticKb(clauses: Sequence) = SideEffect.ResetStaticKb(clauses)

    override fun resetStaticKb(vararg clauses: Clause) = SideEffect.ResetStaticKb(*clauses)

    override fun addStaticClauses(
        clauses: Iterable,
        onTop: Boolean,
    ) = SideEffect.AddStaticClauses(clauses, onTop)

    override fun addStaticClauses(
        clauses: Sequence,
        onTop: Boolean,
    ) = SideEffect.AddStaticClauses(clauses, onTop)

    override fun addStaticClauses(
        vararg clauses: Clause,
        onTop: Boolean,
    ) = SideEffect.AddStaticClauses(*clauses, onTop = onTop)

    override fun removeStaticClauses(clauses: Iterable) = SideEffect.RemoveStaticClauses(clauses)

    override fun removeStaticClauses(clauses: Sequence) = SideEffect.RemoveStaticClauses(clauses)

    override fun removeStaticClauses(vararg clauses: Clause) = SideEffect.RemoveStaticClauses(*clauses)

    override fun resetDynamicKb(clauses: Iterable) = SideEffect.ResetDynamicKb(clauses)

    override fun resetDynamicKb(clauses: Sequence) = SideEffect.ResetDynamicKb(clauses)

    override fun resetDynamicKb(vararg clauses: Clause) = SideEffect.ResetDynamicKb(*clauses)

    override fun addDynamicClauses(
        clauses: Iterable,
        onTop: Boolean,
    ) = SideEffect.AddDynamicClauses(clauses, onTop)

    override fun addDynamicClauses(
        clauses: Sequence,
        onTop: Boolean,
    ) = SideEffect.AddDynamicClauses(clauses, onTop)

    override fun addDynamicClauses(
        vararg clauses: Clause,
        onTop: Boolean,
    ) = SideEffect.AddDynamicClauses(*clauses, onTop = onTop)

    override fun removeDynamicClauses(clauses: Iterable) = SideEffect.RemoveDynamicClauses(clauses)

    override fun removeDynamicClauses(clauses: Sequence) = SideEffect.RemoveDynamicClauses(clauses)

    override fun removeDynamicClauses(vararg clauses: Clause) = SideEffect.RemoveDynamicClauses(*clauses)

    override fun setFlags(flags: Map) = SideEffect.SetFlags(flags)

    override fun setFlags(vararg flags: Pair) = SideEffect.SetFlags(*flags)

    override fun setFlag(
        name: String,
        value: Term,
    ) = SideEffect.SetFlags(name to value)

    override fun resetFlags(flags: Map) = SideEffect.ResetFlags(flags)

    override fun resetFlags(vararg flags: Pair) = SideEffect.ResetFlags(*flags)

    override fun clearFlags(names: Iterable) = SideEffect.ClearFlags(names)

    override fun clearFlags(names: Sequence) = SideEffect.ClearFlags(names)

    override fun clearFlags(vararg names: String) = SideEffect.ClearFlags(*names)

    override fun loadLibrary(library: Library) = SideEffect.LoadLibrary(library)

    override fun unloadLibraries(aliases: Iterable) = SideEffect.UnloadLibraries(aliases)

    override fun unloadLibraries(aliases: Sequence) = SideEffect.UnloadLibraries(aliases)

    override fun unloadLibraries(vararg aliases: String) = SideEffect.UnloadLibraries(*aliases)

    override fun updateLibrary(library: Library) = SideEffect.UpdateLibrary(library)

    override fun resetRuntime(libraries: Runtime) = SideEffect.ResetRuntime(libraries)

    override fun resetRuntime(libraries: Iterable) = SideEffect.ResetRuntime(libraries)

    override fun resetRuntime(libraries: Sequence) = SideEffect.ResetRuntime(libraries)

    override fun resetRuntime(vararg libraries: Library) = SideEffect.ResetRuntime(*libraries)

    override fun addLibraries(libraries: Runtime) = SideEffect.AddLibraries(libraries)

    override fun addLibraries(libraries: Iterable) = SideEffect.AddLibraries(libraries)

    override fun addLibraries(libraries: Sequence) = SideEffect.AddLibraries(libraries)

    override fun addLibraries(vararg libraries: Library) = SideEffect.AddLibraries(*libraries)

    override fun setOperators(operators: Iterable) = SideEffect.SetOperators(operators)

    override fun setOperators(operators: Sequence) = SideEffect.SetOperators(operators)

    override fun setOperators(vararg operators: Operator) = SideEffect.SetOperators(*operators)

    override fun resetOperators(operators: Iterable) = SideEffect.ResetOperators(operators)

    override fun resetOperators(operators: Sequence) = SideEffect.ResetOperators(operators)

    override fun resetOperators(vararg operators: Operator) = SideEffect.ResetOperators(*operators)

    override fun removeOperators(operators: Iterable) = SideEffect.RemoveOperators(operators)

    override fun removeOperators(operators: Sequence) = SideEffect.RemoveOperators(operators)

    override fun removeOperators(vararg operators: Operator) = SideEffect.RemoveOperators(*operators)

    override fun openInputChannels(inputChannels: Map>) =
        SideEffect.OpenInputChannels(
            inputChannels,
        )

    override fun openInputChannels(vararg inputChannels: Pair>) =
        SideEffect.OpenInputChannels(
            *inputChannels,
        )

    override fun openInputChannel(
        name: String,
        inputChannel: InputChannel,
    ) = SideEffect.OpenInputChannels(name to inputChannel)

    override fun resetInputChannels(vararg inputChannels: Pair>) =
        SideEffect.ResetInputChannels(*inputChannels)

    override fun resetInputChannels(inputChannels: Iterable>>) =
        SideEffect.ResetInputChannels(inputChannels)

    override fun resetInputChannels(inputChannels: Sequence>>) =
        SideEffect.ResetInputChannels(inputChannels)

    override fun resetInputChannels(inputChannels: Map>) =
        SideEffect.ResetInputChannels(
            inputChannels,
        )

    override fun closeInputChannels(names: Iterable) = SideEffect.CloseInputChannels(names)

    override fun closeInputChannels(names: Sequence) = SideEffect.CloseInputChannels(names)

    override fun closeInputChannels(vararg names: String) = SideEffect.CloseInputChannels(*names)

    override fun openOutputChannels(outputChannels: Map>) =
        SideEffect.OpenOutputChannels(
            outputChannels,
        )

    override fun openOutputChannels(vararg outputChannels: Pair>) =
        SideEffect.OpenOutputChannels(*outputChannels)

    override fun openOutputChannel(
        name: String,
        outputChannel: OutputChannel,
    ) = SideEffect.OpenOutputChannels(name to outputChannel)

    override fun resetOutputChannels(outputChannels: Iterable>>) =
        SideEffect.ResetOutputChannels(outputChannels)

    override fun resetOutputChannels(outputChannels: Sequence>>) =
        SideEffect.ResetOutputChannels(outputChannels)

    override fun resetOutputChannels(outputChannels: Map>) =
        SideEffect.ResetOutputChannels(
            outputChannels,
        )

    override fun resetOutputChannels(vararg outputChannels: Pair>) =
        SideEffect.ResetOutputChannels(*outputChannels)

    override fun closeOutputChannels(names: Iterable) = SideEffect.CloseOutputChannels(names)

    override fun closeOutputChannels(names: Sequence) = SideEffect.CloseOutputChannels(names)

    override fun closeOutputChannels(vararg names: String) = SideEffect.CloseOutputChannels(*names)

    override fun addEphemeralData(
        key: String,
        value: Any,
    ) = SideEffect.SetEphemeralData(key, value, reset = false)

    override fun  addEphemeralData(data: Map) =
        SideEffect.SetEphemeralData(
            data.mapValues {
                it
            },
            reset = false,
        )

    override fun  addEphemeralData(vararg data: Pair) =
        SideEffect.SetEphemeralData(data.map { (a, b) -> a to (b as Any) }, reset = false)

    override fun setEphemeralData(
        key: String,
        value: Any,
    ) = SideEffect.SetEphemeralData(key, value, reset = false)

    override fun  setEphemeralData(data: Map) =
        SideEffect.SetEphemeralData(
            data.mapValues {
                it
            },
            reset = false,
        )

    override fun  setEphemeralData(vararg data: Pair) =
        SideEffect.SetEphemeralData(data.map { (a, b) -> a to (b as Any) }, reset = false)

    override fun addDurableData(
        key: String,
        value: Any,
    ) = SideEffect.SetDurableData(key, value, reset = false)

    override fun  addDurableData(data: Map) =
        SideEffect.SetDurableData(
            data.mapValues { it },
            reset = false,
        )

    override fun  addDurableData(vararg data: Pair) =
        SideEffect.SetDurableData(data.map { (a, b) -> a to (b as Any) }, reset = false)

    override fun setDurableData(
        key: String,
        value: Any,
    ) = SideEffect.SetDurableData(key, value, reset = false)

    override fun  setDurableData(data: Map) =
        SideEffect.SetDurableData(
            data.mapValues { it },
            reset = false,
        )

    override fun  setDurableData(vararg data: Pair) =
        SideEffect.SetDurableData(data.map { (a, b) -> a to (b as Any) }, reset = false)

    override fun addPersistentData(
        key: String,
        value: Any,
    ) = SideEffect.SetPersistentData(key, value, reset = false)

    override fun  addPersistentData(data: Map) =
        SideEffect.SetPersistentData(
            data.mapValues {
                it
            },
            reset = false,
        )

    override fun  addPersistentData(vararg data: Pair) =
        SideEffect.SetPersistentData(data.map { (a, b) -> a to (b as Any) }, reset = false)

    override fun setPersistentData(
        key: String,
        value: Any,
    ) = SideEffect.SetPersistentData(key, value, reset = false)

    override fun  setPersistentData(data: Map) =
        SideEffect.SetPersistentData(
            data.mapValues {
                it
            },
            reset = false,
        )

    override fun  setPersistentData(vararg data: Pair) =
        SideEffect.SetPersistentData(data.map { (a, b) -> a to (b as Any) }, reset = false)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy