【问题标题】:AnyLogic convert String to NodeAnyLogic 将字符串转换为节点
【发布时间】:2018-07-17 14:15:22
【问题描述】:

有人可以帮我从String 转换为Node 吗?

问题是,当我从database 加载数据时,我无法将varchar 数据类型转换为NodeINode

感谢您的提前!

【问题讨论】:

  • 我也不能将苹果转换为橙子...但您可能不想将字符串转换为节点...您想要问题中未说明的其他内容
  • 我有一个数据库,其中有一个名为“tarhely”的varchar 列。在我的图形编辑器上,我有几个Rectangular node,它们与数据库的“tarhely”列中的值同名。我想将我的Agent 发送到值相同的Rectangular node

标签: java anylogic


【解决方案1】:

如果您想将代理发送到一个矩形节点,该节点的名称与您在数据库中的值相同...

String theName=selectFrom(db_table)
.firstResult(db_table.tarhely);//let's assume this gets you the name of the node
Node rect=findFirst(network.nodes(), n->n.getName().equals(theName)); //this will get you the node

network.nodes() 将为您获取网络中存在的所有节点...如果您有很多节点,请小心选择正确的节点网络...然后您将获得与 findFirst 名称匹配的第一个节点。 .

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-08-28
    • 2013-01-14
    • 1970-01-01
    • 2015-02-06
    • 2019-10-10
    • 1970-01-01
    • 2015-08-10
    • 1970-01-01
    相关资源
    最近更新 更多