[rules-users] Double

Matthew Shaw mshaw at emergency.qld.gov.au
Tue May 29 22:27:49 EDT 2007


I think I understand what's going on finally.

At first parse of the rule the engine is seeing that all conditions are
met and adding to a tuple. On calling modify I think two things are
happening.

1. The  DutyHourTotal object has changed and it is infact adding it to
the tuple.
2. But it is then also removing it because there already exists a tuple
for that unique combination of facts.



-----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.




More information about the rules-users mailing list