Files
HRMS/hrmsEjb/net/sf/jasperreports/engine/fill/JRShortAverageIncrementer.java
2025-07-28 13:56:49 +05:30

25 lines
898 B
Java

package net.sf.jasperreports.engine.fill;
class JRShortAverageIncrementer extends JRAbstractExtendedIncrementer {
private static JRShortAverageIncrementer mainInstance = new JRShortAverageIncrementer();
public static JRShortAverageIncrementer 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 Short((short)(sumValue.shortValue() / countValue.shortValue()));
}
public Object initialValue() {
return JRShortIncrementerFactory.ZERO;
}
}