public class RepositorySorter
extends java.lang.Object
A RepositorySorter performs sorting on an array of RepositoryItem objects, returned as a result of a targeting operation. Sorting is done using the QuickSort algorithm. The passed in SortDirectives object determines how pairs of elements are ordered during sorting.
SortDirectives
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
Constructor and Description |
---|
RepositorySorter() |
Modifier and Type | Method and Description |
---|---|
static int |
compare(java.lang.Object pObject1,
java.lang.Object pObject2,
int pDirection,
boolean pCaseSensitive)
Compares two object values.
|
static RepositoryItem[] |
sort(RepositoryItem[] pItems,
SortDirectives pSortDirectives)
Sorts the specified array of RepositoryItem objects according
to sorting directives specified by pSortDirectives.
|
public static RepositoryItem[] sort(RepositoryItem[] pItems, SortDirectives pSortDirectives)
SortDirectives
public static int compare(java.lang.Object pObject1, java.lang.Object pObject2, int pDirection, boolean pCaseSensitive)
This method knows how to compare objects of the following types: Number, String, Character (using numeric values of the chars), Date, File (using canonical path of the files), and URL (using string representation of the URLs).
pDirection
- direction in which the objects should be
ordered: one of SortDirective.DIR_ASCENDING or
SortDirective.DIR_DESCENDINGpCaseSensitive
- true if compare should be case sensitiveSortDirective.DIR_ASCENDING
,
SortDirective.DIR_DESCENDING