[rules-users] Double

Mark Proctor mproctor at codehaus.org
Tue May 29 21:16:56 EDT 2007


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 at lists.jboss.org 
> [mailto:rules-users-bounces at 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 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/ab58a31f/attachment.html 


More information about the rules-users mailing list