|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.TravelSolutionsSorter
A class used to sort a given list of travel solutions (ConnectionsFinderTasks).
Nested Class Summary | |
private class |
TravelSolutionsSorter.SortTag
A tag used while sorting. |
Field Summary | |
static int |
SORT_ON_AVERAGE_CHANGE_DURATION
Used to indicate that sorting should be on the average duration of the change. |
static int |
SORT_ON_CHANGES_COUNT
Used to indicate that sorting should be on the number of changes. |
static int |
SORT_ON_MAX_CHANGE_DURATION
Used to indicate that sorting should be on the maximal duration of the change. |
static int |
SORT_ON_SIMILARITIES_TO_HISTORY
Used to indicate that sorting should be on the similarity level to the historical cases from the CRN. |
static int |
SORT_ON_TOTAL_DISTANCE
Used to indicate that sorting should be on the total distance of the travel. |
static int |
SORT_ON_TOTAL_DURATION
Used to indicate that sorting should be on the total duration of the travel. |
(package private) TravelSolutionsJudger |
travelSolutionsJudger
The CRN manager used to judge the travel solutions when sorting on similarity to the history. |
Constructor Summary | |
TravelSolutionsSorter(TravelSolutionsJudger travelSolutionsJudger)
Constructor. |
Method Summary | |
private void |
AssignPropertyValues(java.util.ArrayList taggedList,
int sortType)
Assigns the values to the list of sort tags. |
private java.util.ArrayList |
GetTaggedList(java.util.ArrayList travelSolutions)
Gets a list of the given travel solutions boxed within the sort tags. |
private java.util.ArrayList |
GetUntaggedList(java.util.ArrayList taggedList)
Gets a list of travel tasks in the same order as in the given list of SortTags. |
private int |
Partition(java.util.ArrayList array,
int begin,
int end)
Partitions the given range of elements in the given array using the SortTag in the middle as the pivot. |
private void |
QuickSort(java.util.ArrayList array,
int begin,
int end)
Sorts the given range of SortTags on the given list. |
java.util.ArrayList |
SortTravelSolutions(java.util.ArrayList travelSolutions,
int sortType)
Sorts the given list of travel solutions on the given property. |
private void |
Swap(java.util.ArrayList array,
int i,
int j)
Swaps two given element on the given list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
TravelSolutionsJudger travelSolutionsJudger
public static final int SORT_ON_TOTAL_DURATION
public static final int SORT_ON_AVERAGE_CHANGE_DURATION
public static final int SORT_ON_MAX_CHANGE_DURATION
public static final int SORT_ON_CHANGES_COUNT
public static final int SORT_ON_SIMILARITIES_TO_HISTORY
public static final int SORT_ON_TOTAL_DISTANCE
Constructor Detail |
public TravelSolutionsSorter(TravelSolutionsJudger travelSolutionsJudger)
travelSolutionsJudger
- The travel solutions judger.Method Detail |
public java.util.ArrayList SortTravelSolutions(java.util.ArrayList travelSolutions, int sortType)
travelSolutions
- A list of travel solutions to be sorted.sortType
- A property of a travel solution to sort on.
SORT_ON_AVERAGE_CHANGE_DURATION
,
SORT_ON_CHANGES_COUNT
,
SORT_ON_MAX_CHANGE_DURATION
,
SORT_ON_SIMILARITIES_TO_HISTORY
,
SORT_ON_TOTAL_DISTANCE
,
SORT_ON_TOTAL_DURATION
private java.util.ArrayList GetUntaggedList(java.util.ArrayList taggedList)
taggedList
- A list of SortTags.
private void Swap(java.util.ArrayList array, int i, int j)
array
- A list on which the given elements are swapped.i
- Index of the first of elements to be swapped.j
- Index of the second of elements to be swappedprivate int Partition(java.util.ArrayList array, int begin, int end)
array
- An array part of which is to be partitioned.begin
- The first index of the range to be partitioned.end
- The last index of the range to be partitioned.
private void QuickSort(java.util.ArrayList array, int begin, int end)
array
- A list to be sorted.begin
- The first index to be sorted.end
- The last index to be sorted.private void AssignPropertyValues(java.util.ArrayList taggedList, int sortType)
taggedList
- A list of sort tags to be evalueted.sortType
- A property of a travel solution to sort on.SORT_ON_AVERAGE_CHANGE_DURATION
,
SORT_ON_CHANGES_COUNT
,
SORT_ON_MAX_CHANGE_DURATION
,
SORT_ON_SIMILARITIES_TO_HISTORY
,
SORT_ON_TOTAL_DISTANCE
,
SORT_ON_TOTAL_DURATION
private java.util.ArrayList GetTaggedList(java.util.ArrayList travelSolutions)
travelSolutions
- A list of travel solutions to be boxed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |