/** * Builds the weights of all plans. * * @return a map containing the weights of all plans */ Map<T, Double> calcWeights(final HasPlansAndId<T, ?> person) { // - first find the max. score of all plans of this person double maxScore = Double.NEGATIVE_INFINITY; for (T plan1 : person.getPlans()) { if ( (plan1.getScore() != null) && plan1.getScore().isNaN() ) { Logger.getLogger(this.getClass()).error("encountering getScore().isNaN(). This class is not well behaved in this situation. Continuing anyway ...") ; } if ((plan1.getScore() != null) && (plan1.getScore() > maxScore)) { maxScore = plan1.getScore(); } } Map<T, Double> weights = new LinkedHashMap<T, Double>(person.getPlans().size()); for (T plan : person.getPlans()) { weights.put(plan, this.calcPlanWeight(plan, maxScore)); // see note in calcPlanWeight! } return weights; }