package edu.rice.hj.example.comp322.assignments.hw2; 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.
*
* @author Vivek Sarkar (vsarkar@rice.edu)
*/
public class SumReduction implements GeneralizedReduceApp
* sample implementation of client interface for a sum reduction
*/
@Override
public Integer init() {
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public Integer combine(final Integer left, final Integer right) {
// addition with conversion from/to Integer objects
doWork(1);
return left + right;
}
}