changed the scope of TaskResourceNames and SortCriteria to be package private.

This commit is contained in:
Pradyumna Kaushik 2017-08-23 20:10:33 -04:00
parent c2c7a2c090
commit 3c65bdf02e
2 changed files with 8 additions and 8 deletions

View file

@ -1,21 +1,21 @@
package def
// Creating an enumeration of the resources in def.Task.
var TaskResourceNames []string
var taskResourceNames []string
type SortCriteria int
type sortCriteria int
// Map a task's resource name to the sorting criteria (an integer corresponding to the enumeration).
func resourceToSortCriteria(resourceName string) SortCriteria {
func resourceToSortCriteria(resourceName string) sortCriteria {
// Appending resourceName to TaskResourceNames.
TaskResourceNames = append(TaskResourceNames, resourceName)
taskResourceNames = append(taskResourceNames, resourceName)
// Considering index of resource in TaskResourceNames to be the int mapping.
return SortCriteria(len(TaskResourceNames) - 1)
return sortCriteria(len(taskResourceNames) - 1)
}
func (sc SortCriteria) String() string {
return TaskResourceNames[int(sc)]
func (sc sortCriteria) String() string {
return taskResourceNames[int(sc)]
}
// Possible Sorting Criteria

View file

@ -120,7 +120,7 @@ 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.
func TaskSorter(sc SortCriteria, tasks []Task) func (i, j int) bool {
func TaskSorter(sc sortCriteria, tasks []Task) func (i, j int) bool {
return func (i, j int) bool {
taskIFields := reflect.Indirect(reflect.ValueOf(tasks[i]))
tasksJFields := reflect.Indirect(reflect.ValueOf(tasks[j]))