package calculator2003; /** Strategy to use when a number key is hit and it is appropriate * to just accumulate values. * * @author jbergin * * Code Smell: Should be a singleton -- stateless. */ public class AccumulateStrategy implements NumberStrategy { public AccumulateStrategy(CalculatorModel calc) { calculator = calc; } public void apply(int value) { int newValue = calculator.value() * 10 + value; calculator.setDisplay(newValue); } private CalculatorModel calculator = null; }