How to return agents based on same value of a integer parameter

I have agents(Segment) with parameter ring(integer). I want to release my agents when three rings are equal. For example the entries in wait block are as follows 13,25,7,25,13,25,13,7,1,1,7,1,…..
As soon as 3 parameters are equal they should be returned.
I am struggling to compare the parameters in a queue, if anybody can help that would be great.

>Solution :

While this article does not directly answer your question, it has enough information to help you do what you need to do:

The idea is that on each arrival, you will need to loop through the content of the queue or wait block. To do so, On Enter, you write something similar to the following:

List <Segment> segments = findAll(wait,s->s.ring == agent.ring );
if( segments.size() == 3 ) {
  for( Segment s : segments ) { s );

Leave a Reply