ShowAccumulatorsAction.java (moskito-moskito-2.9.3) | : | ShowAccumulatorsAction.java (moskito-moskito-2.10.0) | ||
---|---|---|---|---|
skipping to change at line 204 | skipping to change at line 204 | |||
req.setAttribute("charts", "enable"); | req.setAttribute("charts", "enable"); | |||
if (getForward(req).equalsIgnoreCase("csv")){ | if (getForward(req).equalsIgnoreCase("csv")){ | |||
res.setHeader("Content-Disposition", "attachment; filenam e=\"accumulators.csv\""); | res.setHeader("Content-Disposition", "attachment; filenam e=\"accumulators.csv\""); | |||
} | } | |||
return mapping.findCommand(getForward(req)); | return mapping.findCommand(getForward(req)); | |||
} | } | |||
/*test visibility */ static void normalize(List<AccumulatedValuesBean> va lues, List<String> names, int limit){ | /*test visibility */ static void normalize(List<AccumulatedValuesBean> va lues, List<String> names, int limit){ | |||
for (String name : names){ | for (String name : names){ | |||
//System.out.println("normalizing "+name); | ||||
ArrayList<Float> valueCopy = new ArrayList<Float>(values. size()); | ArrayList<Float> valueCopy = new ArrayList<Float>(values. size()); | |||
//step1 transform everything to float | //step1 transform everything to float | |||
float min = Float.MAX_VALUE, max = Float.MIN_VALUE; | float min = Float.MAX_VALUE, max = Float.MIN_VALUE; | |||
for (AccumulatedValuesBean v : values){ | for (AccumulatedValuesBean v : values){ | |||
float val = Float.parseFloat(v.getValue(name)); | float val = Float.parseFloat(v.getValue(name)); | |||
if (val>max) | if (val>max) | |||
max = val; | max = val; | |||
if (val<min) | if (val<min) | |||
min = val; | min = val; | |||
valueCopy.add(val); | valueCopy.add(val); | |||
} | } | |||
//System.out.println("1: "+valueCopy); | ||||
float range = max - min; | float range = max - min; | |||
float multiplier = limit / range; | float multiplier = limit / range; | |||
//System.out.println("range "+range+", multiplier "+multi plier); | ||||
//step2 recalculate | //step2 recalculate | |||
for (int i=0; i<values.size(); i++){ | for (int i=0; i<values.size(); i++){ | |||
float newValue = (valueCopy.get(i)-min)*multiplie r; | float newValue = (valueCopy.get(i)-min)*multiplie r; | |||
values.get(i).setValue(name, String.valueOf(newVa lue)); | values.get(i).setValue(name, String.valueOf(newVa lue)); | |||
} | } | |||
} | } | |||
} | } | |||
@Override | @Override | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 0 lines changed or added |