All,

I apologize in advance if this is a double post, but my email is acting up so I am resending.

I know I have seen a solution before, but I can not seem to find it at the moment. What I have is a list [actually an enumeration] of objects that I want to evaluate with Drools. How do I go about constructing the rules? If I coded it in straight java it would look something like the following:

double total = 0.0;
Enumeration comps = this.getComponents();
while(comps.hasMoreElements())
{
   Component comp = (Component)comps.nextElement();
   String name = comp.getName();
   if ( name.endsWith("Total"))
  {
      total += Double.parseDouble(comp.getValue());
  }
}

And to make it a little bit more complicated, I have a second list of items that I want to exclude from the total, so second pass is in order. Or I suppose I could add up the first list and then subtract out the second one.

Thanks in advance,

Ron

P.S. - In a second topic does anyone else see their owns posts? I have not been lately.

Reply via email to