package ie.dcu.array; /** * A reduce operation. * * @author Kevin McGuinness */ public interface Reduction { /** * Perform a reduction. * * @param accumulator * The accumulated value so far. * @param value * The next value in the array. * @param index * The index of the value in the array. * @return * The result of the reduction. */ public U reduce(U accumulator, T value, int index); /** * A long width reduction. */ public interface Long { /** * Perform a reduction. * * @param accumulator * The accumulated value so far. * @param value * The next value in the array. * @param index * The index of the value in the array. * @return * The result of the reduction. */ public long reduce(long accumulator, long value, int index); } /** * A double precision reduction. */ public interface Double { /** * Perform a reduction. * * @param accumulator * The accumulated value so far. * @param value * The next value in the array. * @param index * The index of the value in the array. * @return * The result of the reduction. */ public long reduce(double accumulator, double value, int index); } }