<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>Hi
all,</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>I am evaluating
Drools and am stuck with a simple rule that selects elements which do not
correspond to the condition... Since I am updating objects in the RHD, I guess
it has to do with my wrong understanding (and the cache...?)</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><SPAN class=437034512-14042008><FONT
face=Arial color=#000000 size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>I am trying to
allocate lessons to periods (hour). My object model can be summarize is as
follows :</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>Lesson
</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008> <FONT face=Arial
size=2>boolean : allocated // true if the lesson has been
allocated to an hour</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008> <FONT face=Arial
size=2>int :
session
// a session is a bunch of lessons</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>
Subject : subject // an allocated lesson is assigned a
subject</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2>Subject</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008> <FONT face=Arial
size=2>Set<Day> : allocatedDays // days in which this subject is taught -
checked before allocation, as a subject can only be taught once a
day</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2>Hour</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008> <FONT face=Arial
size=2>boolean : allocated // true is this hour has been allocated with a
lesson</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008> D<FONT face=Arial
size=2>ay : day // the day this hour belongs to - required to check with
subject.allocatedDays</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>I put in the
workingMemory a bunch of Lesson objects, which have been set with Subject
and Session id. I also put a bunch of Hour object, set with a
Day.</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial size=2>My rule is as
follows:</FONT></SPAN></DIV>
<DIV><SPAN class=437034512-14042008><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=437034512-14042008><B><FONT color=#960000>
<P align=left><FONT face=Arial size=2>rule</FONT></B></FONT><FONT
face=Arial><FONT size=2> <FONT color=#008000>"allocate"</P></FONT></FONT></FONT>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><B><FONT color=#960000><FONT face=Arial
size=2>when</FONT></P></B></FONT>
<P align=left><FONT size=2><FONT face=Arial>$lesson : Lesson(allocated ==
</FONT><B><FONT color=#960000><FONT
face=Arial>false</FONT></B></FONT></FONT><FONT face=Arial size=2>, session.type
== Session.DISTINCT, $allocatedDays : subject.allocatedDays)</FONT></P>
<P align=left><FONT size=2><FONT face=Arial>$availableHour : Hour(allocated ==
</FONT><B><FONT color=#960000><FONT
face=Arial>false</FONT></B></FONT></FONT><FONT face=Arial><FONT size=2>, day
<B><FONT color=#960000>not</B></FONT></FONT></FONT><FONT face=Arial><FONT
size=2> <B><FONT color=#960000>memberOf</B></FONT></FONT></FONT><FONT face=Arial
size=2> $allocatedDays)</FONT></P>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><B><FONT color=#960000><FONT face=Arial
size=2>then</FONT></P></B></FONT>
<P align=left><FONT face=Arial size=2>$lesson.setHour($availableHour )
;</FONT></P>
<P align=left><FONT size=2><FONT face=Arial>$lesson.setAllocated(</FONT><B><FONT
color=#960000><FONT face=Arial>true</FONT></B></FONT></FONT><FONT face=Arial
size=2>) ;</FONT></P>
<P align=left><B><FONT color=#960000><FONT face=Arial
size=2>update</FONT></B></FONT><FONT face=Arial size=2>($lesson);</FONT></P>
<P align=left><FONT face=Arial size=2></FONT></P>
<P align=left><FONT face=Arial
size=2>$availableHour.setSubject($lesson.getSubject()) ;</FONT></P>
<P align=left><FONT size=2><FONT
face=Arial>$availableHour.setAllocated(</FONT><B><FONT color=#960000><FONT
face=Arial>true</FONT></B></FONT></FONT><FONT face=Arial size=2> );</FONT></P>
<P align=left><B><FONT color=#960000><FONT face=Arial
size=2>update</FONT></B></FONT><FONT face=Arial
size=2>($availableHour);</FONT></P>
<P align=left><FONT face=Arial size=2></FONT></P><FONT color=#960000>
<P><FONT face=Arial size=2><STRONG>end</STRONG></FONT></P>
<DIV><SPAN class=437034512-14042008><SPAN class=437034512-14042008><FONT
face=Arial color=#000000 size=2>When I set a debug on the first line of the THEN
section, I can see that sometimes $availableHour.allocated == true ... sometimes
$lesson.allocated == true (although it's an implicit And statement
...)</FONT></SPAN></DIV>
<DIV>
<P><FONT face=Arial><FONT color=#000000><FONT size=2><SPAN
class=437034512-14042008>Therefore, I can see that the update() works, but it
seems that the rule does not use the updated object (due to shallow copy
??)</SPAN></FONT></FONT></FONT></P>
<P><FONT face=Arial><FONT color=#000000><FONT size=2><SPAN
class=437034512-14042008></SPAN>A<SPAN class=437034512-14042008>ny help more
than welcome</SPAN></FONT></FONT></FONT></SPAN></P></DIV>
<P><SPAN class=437034512-14042008><FONT face=Arial color=#000000
size=2>Regis</FONT></SPAN></P>
<P><SPAN class=437034512-14042008><FONT face=Arial color=#000000
size=2></FONT></SPAN> </P></FONT></SPAN></DIV></BODY></HTML>