How can i retrieve event information from body of some plan (getInitialEvent() in jadex 0.96 version) in jadex 2.0 ?
The method getInitialEvent() has been replaced by the getReason() method. This has been done, because you can now also get information about other triggering reasons for executing a plan, such as belief changes. The method returns an IElement object, which can be casted to the object that you expect. E.g. for a plan triggered by a message event, you should do:
IMessageEvent messageevent = (IMessageEvent)getReason();
---选自faq
The method getInitialEvent() has been replaced by the getReason() method. This has been done, because you can now also get information about other triggering reasons for executing a plan, such as belief changes. The method returns an IElement object, which can be casted to the object that you expect. E.g. for a plan triggered by a message event, you should do:
IMessageEvent messageevent = (IMessageEvent)getReason();
---选自faq
本文详细介绍了在从Jadex 0.96版本升级到2.0版本的过程中,获取初始事件信息的方法发生了变化。原有的getInitialEvent()方法已被getReason()方法取代,原因在于现在可以获取到更多触发执行计划的其他原因,如信念变化。文章提供了实例代码演示如何将返回的IElement对象转换为预期的对象类型,例如对于由消息事件触发的计划,应使用IMessageEvent进行转换。

被折叠的 条评论
为什么被折叠?



