[rules-users] About String..."==" same as ".equals"?

Edson Tirelli tirelli at post.com
Tue Jan 9 14:29:26 EST 2007


   Joel,

   Your rules seems to be correct.
   Questions:

1. What JBRules version are you using?

2. How many MTO instances are you asserting in the working memory, that 
would match each Pattern in your rule?

   It may be an issue with "or". Can you provide a self contained test 
for me to investigate?

   Thank you
      Edson

Joel G. Rivera-González wrote:

> i have to be doing something wrong...but it make no sense...
> a MegaTransferObject is asserted.
>
> case1: No rules fired.
> rule "dtv_discount_request"
>     when
>         MegaTransferObject(other_AccountType == null) or
>         MegaTransferObject(other_AccountType == 
> Constants.PHONE_TYPE_RESIDENTIAL)
>         MegaTransferObject(other_HasDtvDiscountRequest == false)
>     then
>         menu.add(new 
> String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL, 
> Constants.SERVICE_ASSURANCE_MENU_DTV_DISCOUNT_REQUEST});
> end
>
> case 2: no rule fired.
>
> rule "dtv_discount_request"
>     when
>         MegaTransferObject(other_AccountType == null) or
>         MegaTransferObject(other_AccountType == "RMS")
>         MegaTransferObject(other_HasDtvDiscountRequest == false)
>     then
>         menu.add(new 
> String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL, 
> Constants.SERVICE_ASSURANCE_MENU_DTV_DISCOUNT_REQUEST});
> end
>
> case 3: rule fired
>  
> rule "dtv_discount_request"
>     when
>         megaTO:MegaTransferObject(other_AccountType == "RMS")
>         megaTO:MegaTransferObject(other_HasDtvDiscountRequest == false)
>     then
>         menu.add(new 
> String[]{Constants.SERVICE_ASSURANCE_TREE_MENU_DSL, 
> Constants.SERVICE_ASSURANCE_MENU_DTV_DISCOUNT_REQUEST});
> end
>
> i really dont get it...
> i must not be getting something...
> help...
>
>
> Joel G. Rivera-Gonzalez
> PRT
>
> "The first 90% of a project takes 90% of the time, the last 10% takes 
> the other 90% of the time" - Murphy's Law
>
>
> ----- Original Message ----
> From: Edson Tirelli <tirelli at post.com>
> To: Rules Users List <rules-users at lists.jboss.org>
> Sent: Tuesday, January 9, 2007 7:26:35 AM
> Subject: Re: [rules-users] About String..."==" same as ".equals"?
>
>
>    Joel,
>
>    This is the correct syntax and it works (at least we didn't get a
> report for it not working yet):
>
> Object(variable == Constants.value)
>
>    Can you please elaborate about the problem you are having in order
> for us to help solving it? If it is a bug we need to fix.
>
>    Thank you,
>       Edson
>
> Joel G. Rivera-González wrote:
>
> > most (if not all) of my rules will have conditions like this:
> > Object(variable == Constants.value)
> > this is not working...
> > BUT if i change the Constants.value to corresponding value from the
> > constants class it will work...
> > is there any other way other than this Object(a:variable->  
> > (a.equals(Constants.value)) to do it?
> >
> >
> >
> >  
> > Joel G. Rivera-Gonzalez
> > PRT
> >
> > "The first 90% of a project takes 90% of the time, the last 10% takes
> > the other 90% of the time" - Murphy's Law
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >rules-users mailing list
> >rules-users at lists.jboss.org
> >https://lists.jboss.org/mailman/listinfo/rules-users
> >  
> >
>
>
> -- 
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3124-6000
> Mobile: +55 11 9218-4151
> JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list