[rules-users] Help me improve my rules performance.

Wolfgang Laun wolfgang.laun at gmail.com
Mon Nov 16 02:24:43 EST 2009


On Mon, Nov 16, 2009 at 7:16 AM, Greg Barton <greg_barton at yahoo.com> wrote:

> The answer to both questions is basically the same: use the "this"
> reference.
>
> rule CheckValidBinNumber
> when
>   $br:BillingRecord(cardNo!=null || cardNo!="")
>

This part, taken from the original mail, looks suspicious to me: if
cardNo==null, the 2nd term is evaluated and throws a NPE.

   $valid: Boolean(this == false) from checkValidity($br.cardNo)
> then
>   error(BillingRecordHelper.BIN_NO_INVALID_ERROR,log);
> end
>
>
It would be interesting to learn whether a single CE

   $br : BillingRecord( cardNo : cardNo, eval( checkNotNullValid( cardNo ) )

with

boolean checkNotNullInvalid(Sring cardNo){
    return cardNo != null && cardNo != "" && ! checkValidity( cardNo );
}

OR

    $br : BillingRecord( cardNo : cardNo !=null && !="", eval( !
checkValidity(cardNo) ) )

wouldn't be (slightly) more efficient.

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091116/e5bef87d/attachment.html 


More information about the rules-users mailing list