
it.unibo.jakta.agents.bdi.Prolog2Jakta.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakta-bdi Show documentation
Show all versions of jakta-bdi Show documentation
A Kotlin internal DSL for the definition of BDI agents
package it.unibo.jakta.agents.bdi
import it.unibo.tuprolog.core.Struct
import it.unibo.tuprolog.core.Term
import it.unibo.tuprolog.core.visitors.DefaultTermVisitor
object Prolog2Jakta : DefaultTermVisitor() {
override fun defaultValue(term: Term): Term = term
override fun visitStruct(term: Struct): Term {
return when {
term.arity == 2 && term.functor == "," ->
Struct.of("&", term.args.map { it.accept(this) })
term.arity == 2 && term.functor == ";" ->
Struct.of("|", term.args.map { it.accept(this) })
term.arity == 1 && term.functor == "not" ->
Struct.of("~", term.args.map { it.accept(this) })
else -> super.visitStruct(term)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy