简体   繁体   中英

How to get the list of agents in the block Queue in Anylogic?

How to get the list of agents in the block Queue in Anylogic? In my model each agent A located in the Queue at the moment is a container with some agents B. I have to count agents B. To do this I'm trying to get a list of agents A in the Queue:

int countB = 0;
for( AgentA agentA : Queue.contents()) {
    countB = countB + agentA.contents().size();
}
traceln(countB);

but Queue.contents() returns me an empty list. Could you help me? Thanks a lot.

You don't need to use .contents() .

The queue name is enough ie

for( AgentA agentA : Queue )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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