[rules-users] LHS compare two lists
Greg Barton
greg_barton at yahoo.com
Sun Sep 19 18:39:45 EDT 2010
Also, you can avoid duplicate AcquiredCertification errors and o(n^2) run time by making all Lists into Sets.
GreG
On Sep 19, 2010, at 15:57, Esteban Aliverti <esteban.aliverti at gmail.com> wrote:
> You can avoid the eval setting the size restriction inside the list:
>
> List(size == $certifications.size) from collect...
>
> Best,
>
>> El sep 19, 2010 12:29 p.m., "Wolfgang Laun" <wolfgang.laun at gmail.com> escribió:
>>
>> The idea of the rule given below is to collect a List<AcquiredCertification> from a certain User that's contained in the Position object's list of requiredCertifications, and then to compare the sizes. Equality means that User meets all requirements.
>>
>> rule "meets requirements"
>> dialect "mvel"
>> when
>> Position( $certifications: requiredCertifications )
>> User( $name: name, $profile: profile )
>> $got: List() from collect ( AcquiredCertification( certification memberOf $certifications ) from $profile.userCertifications )
>> eval($certifications.size == $got.size )
>> then
>> System.out.println( "Hire " + $name );
>> end
>>
>> -W
>>
>>
>> On 19 September 2010 01:26, lnguyen <mzspdrcr at gmail.com> wrote:
>> >
>> >
>> > Hi,
>> >
>> > I'm trying to determ...
>>
>>
>> _______________________________________________
>> 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/20100919/9f4862dd/attachment.html
More information about the rules-users
mailing list