【发布时间】:2014-12-13 13:32:28
【问题描述】:
我正在创建一个我想经常重复使用的 AnyLogic 代理。在许多 AnyLogic 代理和组件中,您可以在一些空间中输入代码,例如“on receive”或“Action”或“function body”。这些在构建模型时被编译到代理中。一般的程序员是怎么做到的?
例如,假设我有这个代理(显然是伪代码):
Button extends Agent
name : Parameter // A normal parameter for recording the button's name.
color : Parameter // A normal parameter for recording the button's color.
onPress : <code> // User-provided code that is executed when the button is pressed.
客户可以按如下方式使用它:
userButton7 is a Button
name = "Emergency Button"
color = Red
onPress = {
for each Person p in simulation
p.tryToEscapeBuilding()
}
这可能吗?
【问题讨论】:
标签: anylogic