Drools' DRL doesn't know about generics the way Java does. Cast $map.get($cname).
-W On 05/10/2012, raffi <[email protected]> wrote: > Thank you so far. > > I also noticed that my solution is in some way unefficient if there are a > lot of categories. I not only have to change rules saliences, I do have to > change the /not Recommendation(cname == "pets"...)/ lines in every rule, > too. > So I have a new approach leave out the removing of Recommendation facts. > The > solution is near yours, laune. But I have a new problem now. I added a > value > variable (double) to my Recommendation class. I also added a new class that > holds a HashMap (<String, Double>). Where String is the name of the > category > and the double value is dependent on the category (higher prioriry, higher > value). And I now like to calculate the value for each Recommendation that > was added. > rule "calculate recomm value" > salience 15 > when > $recomm : Recommendation($cname : cname, $recomm_value : > recommValue) > $map : HashMap(FilterCriteria.categories) > then > modify ($recomm) { > setRecommValue($recomm_value * $map.get($cname)) > } > end > > But eclipse says: /The operator * is undefined for the argument type(s) > double, Object/ > Using $map.get("test") in a normal java class works perfect and return the > expected double value. Where is the mistake in the rule? > > Thank you > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/mixing-activation-group-and-ruleflow-group-tp4020058p4020142.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
