I've got the following DSL

[when]$NORTH=dh : DealtHand(seat == Seat.NORTH)
[when]$OR=or
[when]HCP {min}-{max}=eval(dh.getHCP() >={min} && dh.getHCP()<={max})
[when]HCP {min}+=eval(dh.getHCP() >={min})
[then]NorthOK=state.setNorthMatch(true);

And I'm trying to execute the following test rule

rule "Test North"
        when
                $NORTH
                HCP 15-17
                $OR 
                HCP 3-8
        then 
                NorthOK;
end

But the second HCP test appears to be ignored, although the rule is successfully
parsed.  In the above construct I only get Norths were the HCP is in the range
15 to 17.  If I swap the order, HCP 3-8 first, then I only get Norths were the
HCP is in the range 3 and 8.  

I could change the DSL to include the check in the DealtHand selection, but this
 would only work in this simple case and would start to get complex in some of
the other constructs I have.

Not 100% sure how this rule is evaluated as there are no brackets in isolating
the OR.  I tried to put brackets around the OR, but the rule would not parse.

Is there a simple way to build a DSL 'or' rule or do I need to rework the DSL.

Thanks,

John   




---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to