Yang,

 

I am was suggesting to have regulation to impose particular order(although it might be a good additional feature as well).  Would like to just to keep the order as it was in collect list. Especially if we are returning List that means it is an ordered collection by definition. It looks like somewhere in the internals of collect there is a HashSet, sitead of ArrayList used that changes the order of the items in the incoming list, and that is what I don’t agree with… I think it must be a bug,

 

-Sergey

 

 

 


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Yang Song
Sent: Monday, August 27, 2007 11:28 AM
To: Rules Users List
Subject: Re: [rules-users] collect return random order

 

I saw someone is requesting LIMIT, here I saw Manukyan is asking for ORDER BY, and also Mark is talking the FROM. Looks like the rule LHS part would become more and more like SQL SELECT statement. :)

 

I think it is the right way. Some Stream Database also extends the SQL to do event aggregation and correlation. The same can be applied to Rule Engine too.

 

Yang

 

On 8/27/07, Manukyan, Sergey <SManukyan@lear.com> wrote:

Folks,

 

When using collect on List of items with some filter (criteria), I need to have result in the same order as it was received:

 

F.e. I have a list of suppliers :

 

List()  :   Supplier("FIRST", Status.ACTIVE),  Supplier("SECOND", Status.INACTIVE), Supplier("THIRD", Status.INACTIVE )

 

And I need to find first INACTIVE supplier, so it must be SECOND supplier.

 

So doing the following :

 

 

When

$l : List()  // list of suppliers

$inactive_supp : ArrayList() from collect Supplier(status == Status.INACTIVE) from $l

Then

            System.out.println($l); // prints FIRST, SECOND, THIRD

System.out.println($inactive_supp);  // prints THIRD, SECOND  …. Instead of SECOND , THIRD

 

 

So I am getting THIRD supplier instead of SECOND as the result..

 

Please advise if it is a bug .., or there is another way of doing that…

 

Thanks,

 

-Sergey

 

 

 

**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users