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

Eric Miles eric.miles at kronos.com
Thu Dec 13 13:54:23 EST 2007


I found the issue, I was missing an import for the java.util.Iterator.
Not that good of an error message, but oh well :)


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



More information about the rules-users mailing list