Optimized distribution sort

feature/top10
Laurent 7 years ago
parent 2c362aa838
commit 775aae9408
  1. 20
      app/src/main/java/net/pokeranalytics/android/calculus/Report.kt

@ -330,22 +330,6 @@ class ComputedResults(group: ComputableGroup, shouldManageMultiGroupProgressValu
this.consolidateProgressStats() this.consolidateProgressStats()
// if (options.evolutionValues != Calculator.Options.EvolutionValues.NONE) {
//
// // Sort points as a distribution
// this._computedStats.keys.filter { it.hasDistributionSorting() }.forEach { stat ->
// // @todo sort
// this._evolutionValues[stat]?.let { pointList ->
//
// pointList.sortBy { point ->
// return@sortBy true
// }
//
// }
//
// }
//
// }
} }
// MPAndroidChart // MPAndroidChart
@ -397,6 +381,8 @@ class ComputedResults(group: ComputableGroup, shouldManageMultiGroupProgressValu
val negative = mutableListOf<Point>() val negative = mutableListOf<Point>()
val positive = mutableListOf<Point>() val positive = mutableListOf<Point>()
points.sortByDescending { it.y }
points.forEach { points.forEach {
if (it.y < 0) { if (it.y < 0) {
negative.add(it) negative.add(it)
@ -405,8 +391,6 @@ class ComputedResults(group: ComputableGroup, shouldManageMultiGroupProgressValu
} }
} }
negative.sortBy { it.y }
positive.sortByDescending { it.y }
negative.forEachIndexed { index, p -> negative.forEachIndexed { index, p ->
entries.add(BarEntry(index.toFloat(), abs(p.y.toFloat()), p.data)) entries.add(BarEntry(index.toFloat(), abs(p.y.toFloat()), p.data))

Loading…
Cancel
Save