[rules-users] Globals in LHS of a rule?
Mark Proctor
mproctor at codehaus.org
Tue Nov 27 12:20:33 EST 2007
Darko IVANCAN wrote:
> Hmm,
>
> Right.
> Size is not a property (getSize), thus (size==2) does not work.
>
> I'm not sure,but myList(size()==2) could work though.
>
you would have to do List() from myList, otherwise it assumes its
reasoning over data asserted into the working memory - hmm I assume that
works, never tried, as I'm not sure its a valid use case - just assert
the object. You can use globals freely in field constraints. Remember
the engine has no idea when globals change, so if they are used in the
LHS they should be considered immutable.
> Does it ?
>
> darko
>
>
> On 27/11/2007 15:09, Michael Zimmermann wrote:
>
>> Hi Darko,
>>
>>
>>
>>> Global java.util.List myList
>>>
>>> rule "SomeOtherRule"
>>> when
>>> myList(size==2);
>>> then
>>> ...
>>> end
>>>
>>>
>> Sorry, won't work. Unable to resolve object type 'diameters'. What works
>> though is:
>>
>> rule "abc"
>> when
>> eval (diameters.size() == 2)
>> then
>> ...
>> end
>>
>> cu, Michael
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071127/24cd2c38/attachment.html
More information about the rules-users
mailing list