changed def.TaskSorter(...) to def.SortTasks(...) for semantics. Now, def.SortTasks(...) also sorts the tasks instead of returning just a func (i, j int) bool {}. Removed TODO from the README associated with this PR

This commit is contained in:
Pradyumna Kaushik 2017-08-26 15:39:45 -04:00
parent 0869bea2d8
commit 9e620eaede
2 changed files with 3 additions and 5 deletions

View file

@ -119,9 +119,8 @@ func labelAndOrder(clusters map[int][]Task, numberOfClusters int, taskObservatio
// Be able to sort an array of tasks based on any of the tasks' resources.
// Retrieve a sorter (same signature as 'Less' function in sort.Interface) for the given sorting criteria.
type TasksToSort []Task
func (ts TasksToSort) TaskSorter(sb sortBy) func (i, j int) bool {
return func (i, j int) bool {
func SortTasks(ts []Task, sb sortBy) {
sort.SliceStable(ts, func (i, j int) bool {
return sb(&ts[i]) <= sb(&ts[j])
}
})
}