0

I would like to measure the time of cars with an unique Id with NEsper. My problem is, that there are several cars on a road. This road has predefined steps. I want to start to stop the time for every unique car that is in first step until this car receives the last step.

select ice.* from pattern[ice = IncomingCarEvent -> every timer:interval(1 sec) and not LastStepEvent]

The problem is, that I don't know how to separate the cars with a given Id. In this example, if one of the cars receives the last step the event does not fire anymore.

4

1 回答 1

0

我不太清楚为什么要测量到最后一步,并且模式显示“不是最后一步”。分区可以通过关联模式中的事件来完成,例如“a=A => B(id=a.id)”。您还可以使用此链接中的上下文声明进行分区:http: //esper.codehaus.org/esper-5.1.0/doc/reference/en-US/html_single/index.html#context_def_keyed 或者您可以找到match-recognize 更容易使用,因为它有更多的逐步方法来表达匹配,就像正则表达式一样。

于 2014-11-26T12:08:03.943 回答