protected final int compare(int i, int j) { curMetrics.incrementCompareCnt(); double d1 = values[i]; double d2 = values[j]; if (d1 == d2) return 0; else return (d1 < d2 ? -1 : 1); }
public final SortMetrics sort(double[] data) { values = data; curMetrics.init(); doSort(); return getMetrics(); }
protected final void swap(int i, int j) { curMetrics.incrementSwapCnt(); double tmp = values[i]; values[i] = values[j]; values[j] = tmp; }
// Metricsのカウンターをprivateにして、メソッドによりインクリメントする。 protected final double probe(int i) { curMetrics.incrementProbeCnt(); return values[i]; }
public final SortMetrics getMetrics() { return curMetrics.clone(); }