import static edu.rice.hj.Module1.doWork; /** * This class contains an implementation of a sum reduction * that implements the GeneralizedReduceApp interface. * * The call to doWork(1) in the combine() method assumes that each call to * combine() takes 1 unit of time, and ignores the cost all other computations. * * This is a test class for your homework and should not be modified. * * Reduction is a sum on integers * * @author Vivek Sarkar (vsarkar@rice.edu) */ public class SumReduction implements GeneralizedReduceApp { @Override public Integer init() { return 0; } @Override public Integer combine(final Integer left, final Integer right) { // addition with conversion from/to Integer objects doWork(1); return left + right; } }