see xml entities
Kai Ruddies wrote:
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





Reply via email to