[rules-users] Re: LHS rule problem with function

Mark Proctor mproctor at codehaus.org
Thu Dec 13 14:23:16 EST 2007


Eric Miles wrote:
> I found the issue, I was missing an import for the java.util.Iterator.
> Not that good of an error message, but oh well :)
>   
Log a JIRA with the bad error message, and what the error message should 
be - and eventually we'll get round to fixing it. Better yet submit a 
patch with a better error message :)
>
> On Thu, 2007-12-13 at 13:50 -0500, Eric Miles wrote:
>   
>> I'm having a problem with a function I'm trying to call, can someone
>> lend some advice?  I've put together a sample rule (I know the rule
>> doesn't make much sense, but humor me).
>>
>> When trying to compile, I get the following error:
>>
>>
>> * (1,54) unable to resolve method using strict-mode:
>> java.lang.Object.calculateTotal(...)
>>
>> Here is the rule and accompanying function
>>
>> package test;
>> import java.util.ArrayList;
>> rule "Find Marker"
>> 	dialect "java" 
>> 	when
>> 		$list: ArrayList()
>> 		Integer() from calculateTotal($list, new Integer(6), new Integer(10))
>> 	then 
>> 		logIt();
>> 		
>> end
>>
>> function void logIt() {
>> 	System.out.println("FOUND!");
>> }
>>
>> function int calculateTotal(ArrayList numbers, Integer val1, Integer
>> val2) {
>> 	int total = 0;
>> 	Iterator it = numbers.iterator();
>> 	while(it.hasNext()) {
>> 		Integer i = (Integer)it.next();
>> 		total += i.intValue();
>> 	}
>> 	return total;
>> }
>>
>> Thanks in advance,
>> Eric
>>     
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071213/0bb79761/attachment.html 


More information about the rules-users mailing list