问题
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