不同阶级的流口水

时间:2016-01-28 19:03:14

标签: java drools drools-guvnor

我正在学习流口水,我试图做的是为支票写条件

例如:

有3个Pojo课程。酒店,客户,付款。

Hotel:
int id
int roomSize;
...getter/setter

Customers:
int id
String name
int groupSize
...getter/setter

Payment:
int id
int amount
...getter/setter

我想要的是编写用于检查混合类的规则,如

if(hotel.roomSize > customer.groupSize && hotel.count > 3 && customer.groupSize == 1) {
    payment.setAmount(50);
} else {
    payment.setAmount((hotel.roomSize - custmer.groupSize) * 65)
}
------------------------
rule "some checks"
    when
        h : Hotel(h.roomCount < 3)
        c : Customer(c.groupSize == 1)

    then
        System.out.println(....);
end

并且一方面怀疑规则中没有别的,所以我必须为每个条件写两条规则吗? 例如:h.roomSize < 3 and another rule for h.roomSize > 3

what I want to achieve is to have a set of rules in sequence like
rule a:
rule b:
rule c:
rule d:
and if b fails dont execute c and d.

0 个答案:

没有答案
相关问题