commonMain.it.unibo.tuprolog.dsl.theory.LogicProgrammingScopeImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-theory-jvm Show documentation
Show all versions of dsl-theory-jvm Show documentation
Kotlin DSL for logic programming, enriched with unification and clause storage facilities
The newest version!
package it.unibo.tuprolog.dsl.theory
import it.unibo.tuprolog.core.Scope
import it.unibo.tuprolog.core.VariablesProvider
import it.unibo.tuprolog.dsl.Termificator
import it.unibo.tuprolog.theory.TheoryFactory
import it.unibo.tuprolog.unify.Unificator
class LogicProgrammingScopeImpl(
override val scope: Scope,
override val termificator: Termificator,
override val variablesProvider: VariablesProvider,
override val unificator: Unificator,
override val theoryFactory: TheoryFactory,
) : LogicProgrammingScope,
VariablesProvider by variablesProvider,
Unificator by unificator,
TheoryFactory by theoryFactory {
init {
require(scope === variablesProvider.scope && scope === termificator.scope) {
"The provided Scope should be the same object for both Termificator and VariablesProvider"
}
require(unificator == theoryFactory.unificator) {
"The provided Unificator should be the same object for both Unificator and TheoryFactory"
}
}
override fun copy(scope: Scope): LogicProgrammingScope =
LogicProgrammingScopeImpl(
scope,
termificator.copy(scope),
variablesProvider.copy(scope),
unificator,
theoryFactory,
)
override fun copy(unificator: Unificator): LogicProgrammingScope =
LogicProgrammingScopeImpl(
scope,
termificator,
variablesProvider,
unificator,
theoryFactory.copy(unificator),
)
override fun newScope(): LogicProgrammingScope = copy(Scope.empty())
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy