Parse the "percentile" section of the query string and returns an list of float that contains the percentile calculation paramters the format of the section: percentile[xx,yy,zz] xx, yy, zz are the floats @param spec @return
(final String spec)
| 896 | * @return |
| 897 | */ |
| 898 | public static final List<Float> parsePercentiles(final String spec) { |
| 899 | List<Float> rs = new ArrayList<Float>(); |
| 900 | int start_pos = spec.indexOf('['); |
| 901 | int end_pos = spec.indexOf(']'); |
| 902 | if (start_pos == -1 || end_pos == -1) { |
| 903 | throw new BadRequestException("Malformated percentile query paramater: " + spec); |
| 904 | } |
| 905 | |
| 906 | String [] floats = Tags.splitString(spec.substring(start_pos + 1, end_pos), ','); |
| 907 | for (String s : floats) { |
| 908 | String trimed = s.trim(); |
| 909 | rs.add(Float.valueOf(trimed)); |
| 910 | } |
| 911 | return rs; |
| 912 | } |
| 913 | |
| 914 | /** @param collector Populates the collector with statistics */ |
| 915 | public static void collectStats(final StatsCollector collector) { |