forall始终认为是正确的[Drools] [英] forall always evaluates to be true [Drools]
本文介绍了forall始终认为是正确的[Drools]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Application类,其中有CallPhone实例的列表。
I have a class Application, within which there is a list of instances of CallPhones.
class Application() {
List<CallPhones> callPhonesList;
...
}
class CallPhones() {
Integer callTimes;
...
}
我想在 callTimes
所有大于10的实例。这是规则:
I want to fire the rule when callTimes
of all instances larger than 10. Here is the rule:
rule "Application eligible"
when
app : Application()
forall(CallPhones(callTimes > 10))
then
// application is eligible
end
奇怪的是,该规则始终会触发,即使存在具有 callTimes
为5。我还尝试了这个问题,但没有任何帮助。有想法吗?
Strangely, the rule always fires, even when there's an instance with callTimes
being 5. I also tried answer of this question, but got no help. Any ideas?
推荐答案
应该是
rule "Application eligible"
when
app : Application()
forall($temp:CallPhones(callUserTimes > 10) from app.callPhoneList)
then
// application is eligible
end
这篇关于forall始终认为是正确的[Drools]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文