[rules-users] Double

Mark Proctor mproctor at codehaus.org
Tue May 29 22:48:05 EDT 2007


That's what modify does, it retracts the fact and then asserts it.

Mark
Matthew Shaw wrote:
> Hi Scott,
>
> My understanding is that the rule will only fire twice regardless
> because there are only two "SheetTotal" objects in working memory which
> is stopping the rule from going into infinite recursion.
>
> The no-loop attribute is also behaving correctly as it is not letting
> the engine add it back onto the Agenda. 
>
> What is interesting however is that in this case the modify is behaving
> exactly as if I were to retract and then assert the DutyHourTotal
> object.   
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org
> [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Scott Reed
> Sent: Wednesday, 30 May 2007 11:48 AM
> To: Rules Users List
> Subject: Re: [rules-users] Double
>
> Matthew Shaw's message received 5/29/2007 9:39 PM:
>   
>> ok point taken. I have modified my rule so that it looks at an object 
>> and I modify a property on that object instead as follows: But still 
>> the same issue.
>>  
>> * *
>>
>> *rule* "sum higher rate totals"
>>
>> *salience* 970
>>
>> *no-loop* *true*
>>
>> *when*
>>
>> timesheet : TimesheetTransferObject( )
>>
>> total : SheetTotalTransferObject($ihrisType : ihrisType -> 
>> ($ihrisType.equals(ihrisType.getDutyHourTotal())), $payRate : payRate 
>> ->
>> ($payRate.equals(timesheet.getOfficer().getSubstantiativeRate()) ==
>> *false*))
>>
>> *eval*(total.getValue().doubleValue() > 0)
>>
>> higherDutyTotal : DutyHourTotal( )
>>
>> *then*
>>
>> higherDutyTotal.setNrHours(DateUtils.addElapsedTimes(higherDutyTotal.g
>> etNrHours(),
>> total.getValue().doubleValue()));
>>
>> *modify*(higherDutyTotal);
>>     
> This modify call tells the rule engine to "look at this DutyHourTotal
> object again." The rule should just keep firing. If there were some
> condition on the DutyHourTotal that eventually was false it would stop
> but I am surprised you only see it fire twice and not forever. Perhaps
> there are side effects of setNrHours() that cause one of the other
> conditions to fail.
>   
>> *
>>
>> end
>>     
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> This correspondence is for the named persons only. 
> It may contain confidential or privileged information or both. 
> No confidentiality or privilege is waived or lost by any mis transmission. 
> If you receive this correspondence in error please delete it from your system immediately and notify the sender. 
> You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. 
> Any opinions expressed in this message are those of the individual sender except where the sender expressly, 
> and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.
>
> _______________________________________________
> 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/20070530/38450d8f/attachment.html 


More information about the rules-users mailing list