Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

https://noorjax.com/2019/07/02/dynamic-batches/

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 ) {
     self.free( s );
  }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading