code: public static Double downsamplerReducer(List<Double> values, String reducerType) {
  		List<Double> operands = new ArrayList<Double>();
  
  		for (Double value : values) {
  			if (value == null) {
  				operands.add(0.0);
  			} else {
  				operands.add(value);
  			}
  		}
  
  		InternalReducerType type = InternalReducerType.fromString(reducerType);
  		switch (type) {
  		case AVG:
  			return new Mean().evaluate(Doubles.toArray(operands));
  		case MIN:
  			return Collections.min(operands);
  		case MAX:
  			return Collections.max(operands);
  		case SUM:
  			return new Sum().evaluate(Doubles.toArray(operands), 0, operands.size());
  		case DEVIATION:
  			return new StandardDeviation().evaluate(Doubles.toArray(operands));
  		case COUNT:
  			values.removeAll(Collections.singleton(null));
  			return (double) values.size();
  		case PERCENTILE:
  			return new Percentile().evaluate(Doubles.toArray(operands), Double.parseDouble(reducerType.substring(1)));
  		default:
  			throw new UnsupportedOperationException("Illegal type: " + reducerType + ". Please provide a valid type.");
  		}
  	}
docs: Implements down sampling.
  
  @param   values       The values to down sample.
  @param   reducerType  The type of down sampling to perform.
  
  @return  The down sampled result.
  
  @throws  UnsupportedOperationException  If an unknown down sampling type is specified.