Shame on me :) It's so easy. I don't know whats going wrong on my first attempt, testing the condition node sharing (i overwrote the equals() method in my Condition). Seems to be not so easy ;) After doing this right it works fine :)
Kai -----Ursprüngliche Nachricht----- Von: Kai Ruddies [mailto:[EMAIL PROTECTED] Gesendet: Montag, 14. November 2005 17:34 An: [email protected] Betreff: [drools-user] Reuse of Conditions Is it possible to reuse a Condition in another rule? In the conway-example the <conway:cellIsAlive/> condition is used in 2 seperate rules: <rule name="Kill The Overcrowded"> <conway:condition cellName="cell"> <conway:cellIsAlive/> <conway:cellIsOverCrowded/> </conway:condition> <conway:actions cellName="cell"> <conway:killCell/> </conway:actions> </rule> <rule name="Kill The Lonely"> <conway:condition cellName="cell"> <conway:cellIsAlive/> <conway:cellIsLonely/> </conway:condition> <conway:actions cellName="cell"> <conway:killCell/> </conway:actions> </rule> The ConwayConditionFactory creates 2 instances of IsCellAliveCondition. if ( childConfig1.getName().equals( "cellIsAlive" ) ) { conditions.add( new IsCellAliveCondition( cellDeclaration ) ); } This means the Condition is checked twice for every cell. For the situation i plan to use drools it can happen that the same condition is used (for example) by 50 rules. Then the "same" condition is checked 50 times! Because of this i try to find a solution to use one condition instance in seperate rules. Thanks & Regards Kai
