A monotonically decreasing sequence a1, a2,... is one without a[i] < a[j]
for all j > i.
$a : StockTick() over window:time(20s)
not StockTick(this after $a, price > $a.price) over window:time(20s)
But I think that it's more efficient to keep track of the status of a stock
by its last quote and the last time there was an increase. The arrival of a
new StockTick is matched in a couple of rules with the StockStatus, which is
updated accordingly.
-W
On 28 January 2011 11:25, OlliSee <o.roess(a)seeburger.de> wrote:
Hello everyone.
Lets say we have StockTicks...
Is it possible to detect a monotonically decreasing StockTick stream over a
window?
If I knew the number of events I want to check on, I'd do it this way
$a : StockTick() over window:time(20s)
$b : StockTick(this after $a, price < $a.price) over window:time(20s)
...
But I don't know for how long the StockTick prices continue to decrease..
I imagine doing something like that
$list : List(size > 0) from collect(StockTick() over window:time(20s))
forall($a : StockTick() from $list
$b : StockTick(this after $a, price < $a.price from $list
)
That results in a nice exception.
Any idea how to do this work? And more efficiently than my approach?
Thanks
Oliver
Exception in thread "Thread-1" java.lang.ClassCastException:
org.drools.common.DefaultFactHandle cannot be cast to
org.drools.common.EventFactHandle
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedLeft(AfterEvaluatorDefinition.java:336)
at
org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:110)
at
org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:115)
at
org.drools.common.DoubleBetaConstraints.isAllowedCachedLeft(DoubleBetaConstraints.java:166)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:274)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:220)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:81)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:279)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:220)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:81)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:662)
at
org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1187)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1089)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:893)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:238)
--
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