2011/1/31 Greg Barton <greg_barton(a)yahoo.com>
Yes, the accumulate function itself should maintain the sort internally.
Which, in this case, means that the timestamp can't be in the
FactHandle, i.e., it must be a field of the class representing the
fact and set by code when the fact is inserted (or received in the
system).
I don't really know (from the first mail in this thread) what the rule
should detect, i.e., due to which condition it should fire. But to
detect a monotonically decreasing sequence over a window of a givent
length it is sufficient to check for the absence of any increase from
one event to a later event. Therefore, a simple "not" pattern should
do. Another pattern would have to ascertain that there are at least 2
elements.
$a : StockTick( $p: price ) over window:time(20s)
exists StockTick( this after $a) over window:time(20s)
not StockTick( this after $a, price >= $p ) over window:time(20s)
-W
@OlliSee : See the thread titled "How to write a rule that fires when it matches
against specific facts in working memory."
--- On Sun, 1/30/11, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
From: Wolfgang Laun <wolfgang.laun(a)gmail.com>
Subject: Re: [rules-users] Writing a pattern in which each event constraint depends on
the previous event
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Date: Sunday, January 30, 2011, 10:25 AM
On 30 January 2011 12:55, OlliSee <o.roess(a)seeburger.de> wrote:
@Wolfgang: I guess you are referring to the list I use. Of course I expect
them to be ordered by timestamp.
You sure do, but the question is whether you get them in this order during processing by
accumulate. There is no documentation that accumulate passes through a set of selected
facts in the order they were inserted. It could just as well be the (random) order of some
hash key, or reverse, or whatever.
-W
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Writing-a-pattern-in-...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-----Inline Attachment Follows-----
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users