first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package net.sf.jasperreports.engine.fill;
|
||||
|
||||
class JRIntegerAverageIncrementer extends JRAbstractExtendedIncrementer {
|
||||
private static JRIntegerAverageIncrementer mainInstance = new JRIntegerAverageIncrementer();
|
||||
|
||||
public static JRIntegerAverageIncrementer getInstance() {
|
||||
return mainInstance;
|
||||
}
|
||||
|
||||
public Object increment(JRCalculable variable, Object expressionValue, AbstractValueProvider valueProvider) {
|
||||
if (expressionValue == null) {
|
||||
if (variable.isInitialized())
|
||||
return null;
|
||||
return variable.getValue();
|
||||
}
|
||||
Number countValue = (Number)valueProvider.getValue(variable.getHelperVariable((byte)0));
|
||||
Number sumValue = (Number)valueProvider.getValue(variable.getHelperVariable((byte)1));
|
||||
return new Integer(sumValue.intValue() / countValue.intValue());
|
||||
}
|
||||
|
||||
public Object initialValue() {
|
||||
return JRIntegerIncrementerFactory.ZERO;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user