The rete view for the following two rules have identical structure: (One alpha
node in each)
rule "Test"
when
t : Thing( foo == "BAR" || == "BAS" );
then
System.out.println( "meh" );
end
rule "Test"
when
t : Thing( foo in("BAR","BAS") );
then
System.out.println( "meh" );
end
So I guess the "|| ==" conditions are combined into one node. I can't peek
into the source at the moment to check, though. And I don't know which is
faster. I'd guess that either is faster than regex for short lists, though.
--- On Tue, 11/17/09, Mauricio Salatino <[email protected]> wrote:
> From: Mauricio Salatino <[email protected]>
> Subject: Re: [rules-users] Need Syntax help for a string match
> To: "Rules Users List" <[email protected]>
> Date: Tuesday, November 17, 2009, 3:31 PM
> @Greg
> Using "in" is better that the multiple || ==
> "18" ?
> It has some relation with indexing?
> With multiple "|| == " the RETE network will
> generate one alpha node for each value right?
>
> But for "in" I don't imagine how it works, I
> also realize that it's not included in the official
> docs.
>
>
> On Tue, Nov 17, 2009 at 7:22 PM,
> Jared Davis <[email protected]>
> wrote:
>
> Here are two ways to write the
> regular expression.
>
>
>
> m : Customer( age matches
> "(18|21|33|28|40|41)")
>
>
>
> m : Customer( age matches
> "(18|2[18]|33|4[01])")
>
>
>
> Did you try
>
>
>
> m : Customer( age in
> ("18","21","33","28","40","41"))
>
>
>
>
>
>
>
> I don't know which solution is faster. I think that
> would
>
> be an interesting test.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> rules-users mailing list
>
> [email protected]
>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users