From 3c65bdf02e67dac4a03190fb7ee453952cadb8ed Mon Sep 17 00:00:00 2001 From: Pradyumna Kaushik Date: Wed, 23 Aug 2017 20:10:33 -0400 Subject: [PATCH] changed the scope of TaskResourceNames and SortCriteria to be package private. --- def/sortingCriteria.go | 14 +++++++------- def/taskUtils.go | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/def/sortingCriteria.go b/def/sortingCriteria.go index fadf562..994581a 100644 --- a/def/sortingCriteria.go +++ b/def/sortingCriteria.go @@ -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 diff --git a/def/taskUtils.go b/def/taskUtils.go index 5dbeb4a..e175e5f 100644 --- a/def/taskUtils.go +++ b/def/taskUtils.go @@ -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]))