forall always evaluates to be true [Drools]

会有一股神秘感。 提交于 2019-12-12 04:09:22

问题


I have a class Application, within which there is a list of instances of CallPhones.

class Application() {
      List<CallPhones> callPhonesList;
      ...
}

class CallPhones() {
      Integer callTimes;
      ...
}

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

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?


回答1:


It should be

rule "Application eligible"
    when
        app : Application()
        forall($temp:CallPhones(callUserTimes > 10) from app.callPhoneList)
    then 
        // application is eligible
end


来源:https://stackoverflow.com/questions/37606319/forall-always-evaluates-to-be-true-drools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!