在我的anylogic模型中,我想从内置数据库中查询一些数据。在agent类型的函数中,这是没有问题的。为了更好的封装,我想把我的代码放到一个类中。
我已经搜索了AnyLogic-help,但我找不到从类中访问数据库的正确方法。
所提供的示例仅在代理类型(https://help.anylogic.com/nav/0_15_10)中工作,因为该函数是由抽象类Utilities提供的,每个代理都继承自该抽象类(https://help.anylogic.com/topic/com.anylogic.help/html/javadoc/com/anylogic/engine/Utilities.html)。
Tuple item = selectFrom( team_knowledge ).
where( team_knowledge.idteam_social.eq( idmember ) ).
where( team_knowledge.idteam_technology.eq( idtechnology ) ).
firstResult(team_knowledge.id, team_knowledge.idteam_social,
team_knowledge.idteam_technology, team_knowledge.is_skill,
team_knowledge.necessary_skill);
Error: The method selectFrom(Qteam_knowledge) is undefined for the type TeamKnowledgeModel你能命名正确的类来解决这个问题吗?
发布于 2019-06-26 16:18:07
只需让类在其构造函数内接受模型中任何Agent的实例。然后它必须使用它来执行任何查询(例如,agent.selectFrom)。
也就是说,该类存储它委托查询的Agent的一个实例。
https://stackoverflow.com/questions/56760411
复制相似问题