我对这个流口水的员工完全陌生。因此,我在这里遇到了一些麻烦。
rule "Raise the alarm when we have one or more fires"
when
exists Fire()
then
insert( new Alarm() );
end
当我有这段代码时,它工作正常。但我想改变一下:
rule "Raise the alarm when we have one or more fires"
when
exists Fire()
then
$alarm = new Alarm();
$alarm.RingBell();
insert( $alarm );
end
可能你明白我在这里想要做什么。我想实例化 Alarm 类并触发它的 RingBell 方法。但它给了我这个错误
Rule Compilation error : [Rule name='Raise the alarm when we have one or more fires']
com/sample/Rule_Raise_the_alarm_when_we_have_one_or_more_fires_cd7449c70a6a48c78f4e291495d23b05.java (8:436) : alarm cannot be resolved
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:117)
at com.sample.DroolsTest.main(DroolsTest.java:28)
如果你们在这里帮助我,我将不胜感激:))