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.get
NrHours(), total.getValue().doubleValue()));
modify(higherDutyTotal);
end
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Wednesday, 30 May 2007 11:17 AM
To: Rules Users List
Subject: Re: [rules-users] Double
It's standard java pass by reference stuff:
String a = "xxx";
String b = a;
System.out.println( b ); // gives "xxx"
a = "yyyy";
System.out.println( b ); // still gives "xxx"
Mark
Matthew Shaw wrote:
Why is it seeing it as a new object? I am asserting it into the
working memory before hand.
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: Wednesday, 30 May 2007 1:27 AM
To: Rules Users List
Subject: Re: [rules-users] Double
highDutyTotal is a new fact inside of your consequence, so when
you call modify, it's actually working as an assert - you are not doing
a modify there at all.
Mark
Matthew Shaw wrote:
Hi there,
seeing some very strange behaviour from the following
rule
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)
highDutyTotal : Double( )
then
highDutyTotal = new
Double(DateUtils.addElapsedTimes(highDutyTotal.doubleValue(),
total.getValue().doubleValue()));
modify(highDutyTotal)
end
In my test the rule fires twice when I don't call
modify. Which is the expected behaviour because I have two unqiue
SheetTotalTransferObject objects.
However when I call modify on the Double object the rule
only runs once. This is incorrect behaviour.
Can anyone offer any clues as to what may be happening
here. Is it to do with my use of the Double type?
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(a)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(a)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.