0
我有对象列表Person。对象Person包含对象Car的列表。我如何从列表中选择只有thoose Person,其中包含Car选择的类型。对于exmplain:品牌“宝马”的汽车。我不知道这样做没有循环。Drools中列表中的搜索元素
person[0].addCar(new Car("BMW"));
person[0].addCar(new Car("Ford"));
person[1].addCar(new Car("Ford"));
person[1].addCar(new Car("Ford"));
person[1].addCar(new Car("Ford"));
如何我可以在drools-regulations中返回person [0]。
我的代码不起作用。
rule "HardDrool"
salience 100
when
$world : World();
$persons: Human(
(name == "Yura"),
(!cars.isEmpty()),
(Car(name == "BMW") from getCars())
) from $world.getPersons()
then
System.out.println($persons);
end
谢谢。是工作。 –