it.unibo.jakta.agents.bdi.environment.Environment.kt Maven / Gradle / Ivy
package it.unibo.jakta.agents.bdi.environment
import it.unibo.jakta.agents.bdi.Agent
import it.unibo.jakta.agents.bdi.AgentID
import it.unibo.jakta.agents.bdi.messages.Message
import it.unibo.jakta.agents.bdi.actions.ExternalAction
import it.unibo.jakta.agents.bdi.beliefs.BeliefBase
import it.unibo.jakta.agents.bdi.environment.impl.EnvironmentImpl
import it.unibo.jakta.agents.bdi.messages.MessageQueue
import it.unibo.jakta.agents.bdi.perception.Perception
interface Environment {
val agentIDs: Map
val externalActions: Map
val messageBoxes: Map
val data: Map
val perception: Perception
fun getNextMessage(agentName: String): Message?
fun popMessage(agentName: String): Environment
fun submitMessage(agentName: String, message: Message): Environment
fun broadcastMessage(message: Message): Environment
fun addAgent(agent: Agent): Environment
fun removeAgent(agentName: String): Environment
fun percept(): BeliefBase = perception.percept()
fun addData(key: String, value: Any): Environment
fun removeData(key: String): Environment
fun updateData(newData: Map): Environment
fun copy(
agentIDs: Map = this.agentIDs,
externalActions: Map = this.externalActions,
messageBoxes: Map = this.messageBoxes,
perception: Perception = this.perception,
data: Map = this.data,
): Environment
companion object {
fun of(
agentIDs: Map = emptyMap(),
externalActions: Map = emptyMap(),
messageBoxes: Map = emptyMap(),
perception: Perception = Perception.empty(),
data: Map = emptyMap(),
): Environment = EnvironmentImpl(
externalActions,
agentIDs,
messageBoxes,
perception,
data,
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy