atg.repository
Class RepositorySorter

java.lang.Object
  extended by atg.repository.RepositorySorter

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.

See Also:
SortDirectives

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
RepositorySorter()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

RepositorySorter

public RepositorySorter()
Method Detail

sort

public static RepositoryItem[] sort(RepositoryItem[] pItems,
                                    SortDirectives pSortDirectives)
Sorts the specified array of RepositoryItem objects according to sorting directives specified by pSortDirectives. Returns the sorted array; the original array may also be modified.

See Also:
SortDirectives

compare

public static int compare(java.lang.Object pObject1,
                          java.lang.Object pObject2,
                          int pDirection,
                          boolean pCaseSensitive)
Compares two object values. Returns an integer that is < 0 if pObject1 should come before pObject2, > 0 if pObject should come after pObject2, or 0 if the order is indeterminate (i.e., either the two objects are equal, or they are not comparable).

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).

Parameters:
pDirection - direction in which the objects should be ordered: one of SortDirective.DIR_ASCENDING or SortDirective.DIR_DESCENDING
pCaseSensitive - true if compare should be case sensitive
See Also:
SortDirective.DIR_ASCENDING, SortDirective.DIR_DESCENDING