Why can't I use indexOf() to look for index of specific object in List in when
?
Here is the example. Once I comment out list.indexOf($o) > 0
, rule executes and index shows correct in then
section.
declare Seq
list: List
end
rule "initSeq"
when
$p: ObjectWrapper (
...
)
$list: List () from collect (ObjectWrapper (...))
not initSeq (....)
then
Seq w = new Seq ();
w.setList($list);
end
rule "doSeq"
when:
$o: ObjectWrapper (
...
)
$rr: Seq (
...
list.indexOf($o) > 0
)
then:
DroolsLogger.debug ("index: " + $rr.getList().indexOf($o));
end
I confirm that indexOf() works in LHS. I still do not understand the reason why it is was not working for me before, but now I have working rule with indexOf in LHS.