package accumulate.poly1;
public class IntAccumulator implements Accumulator {
private int n;
public IntAccumulator(int initialValue) {
n = initialValue;
}
public Object incrementBy(Object inc) {
n = n + ((Number)inc).intValue();
return new Integer(n);
}
}
|