[rules-users] newbie question: forming event pairs

Wouter De Borger w.deborger at gmail.com
Fri Jun 24 11:10:31 EDT 2011


Hi all,

I'm new to drools and I have the following problem:

A stream of Start and Stop events comes into the engine.
The start and stop events should be paired and transformed into ranged
events.
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.

The problem is comparable to what a parser would do to match nested braces.

A sequence of the form

1: Start
2: Start
3: Start
4: End
5: Start
6: End
7: End
8: End

should form the following pairs

3-4
5-6
2-7
1-8

I checked the documentation but I still have two problems:

   1. how can I find the next stop event (or previous start)
   2. how can I make sure the pairs are formed innermost first?


Thanks in advance,
Wouter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110624/e0683c55/attachment.html 


More information about the rules-users mailing list