[rules-users] need to manipulate ArrayList in rules Reg:

Michael Anstis michael.anstis at gmail.com
Mon Dec 27 14:57:22 EST 2010


As a reminder, if you need to know the ClassA to which the Student belongs
you'll need to make the association to avoid cross-products:-

when
$s : Student( )
$c : ClassA( students contains $s )
then
...

2010/12/27 Esteban Aliverti <esteban.aliverti at gmail.com>

> You have 2 simple approaches:
>
>    1. Insert all your Students as facts and create regular rules like
>    *Student(name == 'something')*
>    2. Use the *from* keyword:
>    *$c: ClassA ()
>    Student(name == "something") from $c.students*
>
>
> Best Regards,
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
> - Developer @ http://www.plugtree.com
> - Blog @ http://ilesteban.wordpress.com
>
>
>
> On Mon, Dec 27, 2010 at 5:23 AM, Murali Venugopal <
> murali.venugopal at sifycorp.com> wrote:
>
>>
>> Hi,
>>
>> I'm inserting an Object calld ClassA into the working memory. Which has
>> got it's students in an ArrayList
>>
>> Like this...
>>
>> public class ClassA {
>>
>> private String RoomNo;
>> private ArrayList<Student>  students;
>>
>> ...
>>
>> }
>>
>> public class Student {
>>
>> private String name;
>> private String rollNo;
>>
>> ...
>>
>> }
>>
>> Now, i've to write a rule to find a particular student with his role
>> number and fetch his name to make some decisions.
>>
>> I don't know to write a rule to access an Object's data member of type
>> ArrayList and find a match. Please help.
>>
>> Thanks in advance.
>>
>>  _ _     _ _ |.
>> | | ||_|| (_|||  \/
>>
>> Whoever wants to be happy, let him be so: of tomorrow there's no knowing
>>
>>
>>
>> Get your world in your inbox!
>>
>> Mail, widgets, documents, spreadsheets, organizer and much more with your
>> Sifymail WIYI id!
>> Log on to http://www.sify.com
>>
>> ********** DISCLAIMER **********
>> Information contained and transmitted by this E-MAIL is proprietary to
>> Sify Limited and is intended for use only by the individual or entity to
>> which it is addressed, and may contain information that is privileged,
>> confidential or exempt from disclosure under applicable law. If this is a
>> forwarded message, the content of this E-MAIL may not have been sent with
>> the authority of the Company. If you are not the intended recipient, an
>> agent of the intended recipient or a  person responsible for delivering
>> the
>> information to the named recipient,  you are notified that any use,
>> distribution, transmission, printing, copying or dissemination of this
>> information in any way or in any manner is strictly prohibited. If you
>> have
>> received this communication in error, please delete this mail & notify us
>> immediately at admin at sifycorp.com
>> _______________________________________________
>> 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/20101227/e744ec2b/attachment.html 


More information about the rules-users mailing list