27 lines
876 B
Java
27 lines
876 B
Java
package net.sf.jasperreports.engine.fill;
|
|
|
|
class JRShortSumIncrementer extends JRAbstractExtendedIncrementer {
|
|
private static JRShortSumIncrementer mainInstance = new JRShortSumIncrementer();
|
|
|
|
public static JRShortSumIncrementer getInstance() {
|
|
return mainInstance;
|
|
}
|
|
|
|
public Object increment(JRCalculable variable, Object expressionValue, AbstractValueProvider valueProvider) {
|
|
Number value = (Number)variable.getIncrementedValue();
|
|
Number newValue = (Number)expressionValue;
|
|
if (newValue == null) {
|
|
if (variable.isInitialized())
|
|
return null;
|
|
return value;
|
|
}
|
|
if (value == null || variable.isInitialized())
|
|
value = JRShortIncrementerFactory.ZERO;
|
|
return new Short((short)(value.shortValue() + newValue.shortValue()));
|
|
}
|
|
|
|
public Object initialValue() {
|
|
return JRShortIncrementerFactory.ZERO;
|
|
}
|
|
}
|