Hi - I am a Drools newbie and I apologize in advance if the answer to my question is intuitively obvious to the casual user.

I have an object that has two fields: location(there are more than 50 locations) and age.  I am having difficulty building clean rules for the following pseudo-code


// Rule One
if(location == "A") {
   if(age > 60)
      do_something();
}
// Rule Two
else if(location == "B") {
    if(age > 70)
        do_something();
}
// Rule Three
else if(location == "C") {
    if(age > 80)
        do_something();
}
// Rule Four
else {
    if(age > 65)
        do_something();
}

The issue comes with Rule Four.  How do I avoid writing the rule so that I don't have to say (location!="A"&&location!="B"&&location!="C") ?  I also don't want to have to write an explicit rule for every possible location.

I considered an activation-group with salience to have the rules executed in order, but the problem is that if rules 1-3 do not fire, then rule 4 fires for all locations - I can get a hit if location=="C" and age==70.

Is it possible to have a 'Map' and do something like (age>map.get(location)) ?  I could live with creating a map with all possible locations for key, although I'd rather not go this route.

This problem is typical for the types of rules I'll be writing ... there can be completely different sets of rule criteria depending on location.


Thanks in advance for your suggestions and your patience.