Hi all,<br><br>I&#39;m new to drools and I have the following problem:<br><br>A stream of Start and Stop events comes into the engine.<br>The start and stop events should be paired and transformed into ranged events. <br>Each start event should be paired to the first next stop event that is not part of a pair already, with precedence for the last start event that came in. <br>
<br>The problem is comparable to what a parser would do to match nested braces. <br><br>A sequence of the form<br><br>1: Start <br>2: Start <br>3: Start <br>4: End <br>5: Start <br>
6: End <br>7: End <br>8: End <br><br>should form the following pairs <br><br>3-4<br>5-6<br>
2-7<br>1-8<br><br>I checked the documentation but I still have two problems:<br><ol><li>how can I find the next stop event (or previous start)<br></li><li>how can I make sure the pairs are formed innermost first?<br></li>
</ol><br>Thanks in advance,<br>Wouter<br>