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 <[email protected]> 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" <[email protected]> 
>> 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 <[email protected]> wrote:
>> >
>> >
>> > Hi,
>> >
>> > I'm trying to determ...
>> 
>> 
>> _______________________________________________
>> rules-users mailing list
>> [email protected]
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
> 
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to