27 lines
877 B
Java
27 lines
877 B
Java
package net.sf.jasperreports.engine.fill;
|
|
|
|
class JRIntegerSumIncrementer extends JRAbstractExtendedIncrementer {
|
|
private static JRIntegerSumIncrementer mainInstance = new JRIntegerSumIncrementer();
|
|
|
|
public static JRIntegerSumIncrementer 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 = JRIntegerIncrementerFactory.ZERO;
|
|
return new Integer(value.intValue() + newValue.intValue());
|
|
}
|
|
|
|
public Object initialValue() {
|
|
return JRIntegerIncrementerFactory.ZERO;
|
|
}
|
|
}
|