rule "STANDARD - set available application"
salience(2)
when
accumulate ( Application( $priority : priority, running == false), $highestPriority : min( $priority ) )
then
System.out.println("set app: "+$highestPriority );
end
我的代码在上面。我的目标是找到运行== false的应用程序并获得这些应用程序的最高优先级(最高值是最低值),但此规则会触发所有应用程序并忽略我的条件。思考???
答案 0 :(得分:2)
此处无需使用和累积模式。您可以将规则重写为以下内容:
rule "STANDARD - set available application"
salience(2)
when
$highestPriorityApp: Application(running == false, $highestPriority : priority)
not Application(running == false, priority < $highestPriority)
then
System.out.println("set app: "+$highestPriorityApp );
end
希望它有所帮助,