private double aggregate() {
    double ret;
    switch (aggregator) {
      case "min":
        ret = valueWindow.min();
        break;
      case "max":
        ret = valueWindow.max();
        break;
      case "mean":
        ret = valueWindow.average();
        break;
      case "median":
        ret = valueWindow.median();
        break;
      case "first":
        ret = valueWindow.get(0);
        break;
      case "last":
        ret = valueWindow.get(valueWindow.size() - 1);
        break;
      default:
        throw new IllegalArgumentException("Error: Illegal Aggregation Algorithm.");
    }
    return ret;
  }
Aggregate data in the window to one value according to given method.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/util/Resampler.java