[rules-users] Plz reply : Descending order rule

Anstis, Michael (M.) manstis1 at ford.com
Thu Feb 21 09:02:13 EST 2008


Sorry I agree with Christian not Scott!

I will try to refer to the correct email in my inbox next time ;-)

-----Original Message-----
From: Anstis, Michael (M.) 
Sent: 21 February 2008 14:00
To: 'Rules Users List'
Subject: RE: [rules-users] Plz reply : Descending order rule

Code:-

public static final void main(String[] args) {
	...
	WorkingMemory wm = ruleBase.newStatefulSession();

	wm.insert(new Order(1));
	wm.insert(new Order(2));
	wm.insert(new Order(3));
	wm.fireAllRules();

	...
} 

Rule:-

rule "Descending order"
    when
        $a : Order( $value : value )
        not Order( value > $value)
    then
        System.out.println("value :"+$value);                
        retract($a);
end

Gives:-

value :3
value :2
value :1

I agree with Scott, is there something else afoot?

-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Christian Spurk
Sent: 21 February 2008 13:20
To: Rules Users List
Subject: Re: [rules-users] Plz reply : Descending order rule

Hi Barath!

Barath wrote:
> This indicates the rule should fire for three times but its not the case.

Looking at your last e-mail only: as far as I can see, the rule indeed 
fires exactly three times ... It prints the following:

value :3
value :2
value :1

Probably I don't quite understand the problem? Or maybe your actual 
problem does not occur in this simple testcase?

Best,
Christian
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 7206 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080221/aa373da4/attachment.bin 


More information about the rules-users mailing list