it.unibo.jakta.agents.bdi.dsl.MasScope.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.environment.EnvironmentScope
import it.unibo.jakta.agents.bdi.environment.Environment
import it.unibo.jakta.agents.bdi.executionstrategies.ExecutionStrategy
@JaktaDSL
class MasScope : Builder {
var env: Environment = Environment.of()
var agents: List = emptyList()
var executionStrategy = ExecutionStrategy.oneThreadPerMas()
fun environment(f: EnvironmentScope.() -> Unit): MasScope {
env = EnvironmentScope().also(f).build()
return this
}
fun environment(environment: Environment): MasScope {
env = environment
return this
}
fun agent(name: String, f: AgentScope.() -> Unit): MasScope {
agents += AgentScope(name).also(f).build()
return this
}
fun executionStrategy(f: () -> ExecutionStrategy): MasScope {
executionStrategy = f()
return this
}
override fun build(): Mas = Mas.of(executionStrategy, env, agents)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy