简体   繁体   English

如何扣押一部分扣押资源?

[英]How do I seize a subset of seized resources?

I have a pool of 25 agents (Operators). 我有25位代理商(运营商)。 When an Order is generated, I seize a few Operators and move them to one of many different ProductionSuites as determined by a parameter in the Order. 生成订单时,我抓住了几个运算符,并将它们移动到由订单中的参数确定的许多不同的ProductionSuite中的一个。

Within the ProductionSuite, I have a variable of type ResourcePool that I would like to use to have these Operators perform tasks. 在ProductionSuite中,我想使用类型为ResourcePool的变量来使这些操作员执行任务。

在此处输入图片说明

In the main window, I put this code in the "On seize unit:" code box: 在主窗口中,将此代码放在“占用单元:”代码框中:

agent.assignedSuite.suiteOperatorPool.addAgentToContents(unit);

but this triggers a NullPointerException error. 但这会触发NullPointerException错误。 Am I using the addAgentToContents method incorrectly? 我是否使用了不正确的addAgentToContents方法?

You have not initialized your suiteOperatorPool variable, it's "initial value" field is empty. 您尚未初始化suiteOperatorPool变量,它的“初始值”字段为空。 Hence, this is just an empty shell of type ResourcePool that cannot do anything, including adding agents to it. 因此,这只是ResourcePool类型的空外壳,无法执行任何操作,包括向其中添加代理。

You would need to initialize it properly using the ResourcePool API, but I don't think that is possible. 您将需要使用ResourcePool API正确地对其进行初始化,但是我认为这是不可能的。

Also, you cannot have resources be part of 2 resource pools, as you are trying to do. 另外,您不能像尝试那样将资源作为2个资源池的一部分。 You should think of a different way to solve your problem. 您应该考虑解决问题的另一种方法。 Maybe rephrase the issue so we can think of alternatives. 也许改写这个问题,以便我们考虑其他选择。 You might not need a RP at all but just use pure agent functionality...? 您可能根本不需要RP,而仅使用纯代理功能...?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM