it.unibo.jakta.agents.bdi.dsl.Dsl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakta-dsl Show documentation
Show all versions of jakta-dsl Show documentation
A Kotlin internal DSL for the definition of BDI agents
package it.unibo.jakta.agents.bdi.dsl
import it.unibo.jakta.agents.bdi.Agent
import it.unibo.jakta.agents.bdi.Mas
import it.unibo.jakta.agents.bdi.dsl.actions.ExternalActionScope
import it.unibo.jakta.agents.bdi.dsl.actions.ExternalActionsScope
import it.unibo.jakta.agents.bdi.dsl.actions.InternalActionScope
import it.unibo.jakta.agents.bdi.dsl.actions.InternalActionsScope
import it.unibo.jakta.agents.bdi.dsl.environment.EnvironmentScope
import it.unibo.jakta.agents.bdi.dsl.plans.PlansScope
import it.unibo.jakta.agents.bdi.environment.Environment
import it.unibo.jakta.agents.bdi.plans.Plan
import it.unibo.tuprolog.core.Struct
import it.unibo.tuprolog.core.Term
@DslMarker
annotation class JaktaDSL
@JaktaDSL
fun mas(f: MasScope.() -> Unit): Mas =
MasScope().also(f).build()
fun internalAction(name: String, arity: Int, f: InternalActionScope.() -> Unit) =
InternalActionsScope().newAction(name, arity, f)
fun externalAction(name: String, arity: Int, f: ExternalActionScope.() -> Unit) =
ExternalActionsScope().newAction(name, arity, f)
@JaktaDSL
fun environment(f: EnvironmentScope.() -> Unit): Environment = EnvironmentScope().also(f).build()
@JaktaDSL
fun agent(name: String, f: AgentScope.() -> Unit): Agent = AgentScope(name).also(f).build()
fun plans(f: PlansScope.() -> Unit): Iterable = PlansScope().also(f).build()
operator fun String.invoke(vararg terms: Term): Struct =
Struct.of(this, *terms)
operator fun String.invoke(terms: List): Struct =
Struct.of(this, terms)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy