to write it as a plain rule (leaving out the values you had):
when
dh : DealtHand(seat == Seat.NORTH)
eval(dh.getHCP() >={min} && dh.getHCP()<={max})
or
eval(dh.getHCP() >={min} && dh.getHCP()<={max})
that can't work as the right hand side of the or will not have the "dh"
bound variable.
Not sure if brackets will help.
A better option is to asset the HCP object seperately,
then you can do:
dh : DealtHand(seat == Seat.NORTH)
hcp : HCP(dealtHand == dh, value > {min})
etc.... and let the rule engine join it all up.
On 12/29/06, John Howard <[EMAIL PROTECTED]> wrote:
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