我从流口水引擎开始。我调整了他们的示例程序。它似乎不起作用。无论MessageItem
我在里面放了多少Message
,我总是会在控制台上打印一个“测试”。
这是我的列表文件:
package com.sample
import com.sample.Message;
import com.sample.MessageItem;
rule "Hello World"
when
m : Message( status == Message.HELLO, $mItems : messageItems)
mi : MessageItem(message == m, item == "test") from $mItems
then
System.out.println( "Test "); # This is printed only once.
# code to update m and mi
update( m );
update (mi);
end
end
这是我的课程,我省略了 getter/setter
public static class Message {
public static final int HELLO = 0;
public static final int GOODBYE = 1;
private String message;
private List<MessageItem> messageItems = new ArrayList<MessageItem>();
private int status;
}
public static class MessageItem {
private String item;
private Message message;
}