“不”的概念意义关键词;对象之间的评估
我试图在 Drools Planner 项目中找到一个具有最小 total
的 BucketTotal
对象。我根据示例代码改编了它。
rule "insertMinimumBucketTotal"
when
$b : BucketTotal($total : total)
not BucketTotal(total > $total) // CONFUSED HERE
then
insertLogical(new MinimumBucketTotal($total));
end
就我的推理而言,这意味着“找到 BucketTotal
对象 $b
,这样就不存在另一个 BucketTotal
对象,其 total
大于$b
的总计
”。
事实证明,这意味着相反(我纠正了它)。
请解释 Drools 如何推理该语句来查找 $b
。
I am trying to find a BucketTotal
object which has the smallest total
in a Drools Planner project. I adapted this from example code.
rule "insertMinimumBucketTotal"
when
$b : BucketTotal($total : total)
not BucketTotal(total > $total) // CONFUSED HERE
then
insertLogical(new MinimumBucketTotal($total));
end
As far as my reasoning went, it meant "find BucketTotal
object $b
, such that there doesnt exist another BucketTotal
object whose total
is greater than total
of $b
".
Turns out, it meant the opposite (and I corrected it).
Please explain how Drools reasons that statement to find $b
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确实你的事情令人困惑。 “不”的意思是“不存在”。因此,如果您想找到最小总数,您可以这样做:
上述通常是性能更高的方法,但如果您愿意,也可以使用累积:
Indeed your are confusing things. "not" means "not exists". So if you want to find the minimum total you can do:
The above is usually the more performant way of doing it, but you can also use accumulate if you prefer: