dkdelta
dkdelta

Reputation: 53

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.

Upvotes: 0

Views: 425

Answers (1)

Emile Zankoul
Emile Zankoul

Reputation: 2213

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

The queue name is enough i.e.

for( AgentA agentA : Queue )

Upvotes: 0

Related Questions