ariba.util.core
Class Sort

java.lang.Object
  extended by ariba.util.core.Sort
Direct Known Subclasses:
IntCompanionSort

public class Sort
extends java.lang.Object

Sort provides functions for sorting arrays of objects.


Field Summary
static int SortAscending
          Constant to specify an ascending sort order
static int SortDescending
          Constant to specify a descending sort order
static int SortNone
           
 
Method Summary
static int getSwapDirection(int direction)
          Returns the opposite of the given sort direction.
static void objects(java.lang.Object[] a, Compare c)
          Sort an array of objects into an ascending sort order.
static void objects(java.lang.Object[] a, Compare c, int dir)
          Sort an array of objects in a specified direction.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, Compare c)
          Sort two arrays in ascending order, using one array for the keys.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, Compare c, int dir)
          Sort two arrays in a specified order, using one array for the keys.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, java.lang.Object[] c2, Compare c)
          Sort three arrays in ascending order, using one array for the keys.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, java.lang.Object[] c2, Compare c, int dir)
          Sort three arrays in a specified order, using one array for the keys.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, java.lang.Object[] c2, int first, int n, Compare c)
          Sort a range of elements in three arrays in ascending order, using one array for the keys.
static void objects(java.lang.Object[] a, java.lang.Object[] c1, java.lang.Object[] c2, int first, int n, Compare c, int dir)
          Sort a range of elements in three arrays in a specified order, using one array for the keys.
static Compare reverseCompare(Compare c)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SortAscending

public static final int SortAscending
Constant to specify an ascending sort order

See Also:
Constant Field Values

SortNone

public static final int SortNone
See Also:
Constant Field Values

SortDescending

public static final int SortDescending
Constant to specify a descending sort order

See Also:
Constant Field Values
Method Detail

objects

public static void objects(java.lang.Object[] a,
                           Compare c)
Sort an array of objects into an ascending sort order.

Parameters:
a - an array of objects to sort
c - an object to that implements the comparison interface

objects

public static void objects(java.lang.Object[] a,
                           Compare c,
                           int dir)
Sort an array of objects in a specified direction.

Parameters:
a - an array of objects to sort
c - an object to that implements the comparison interface
dir - the direction to sort the objects in. Must be SortAscending or SortDescending
See Also:
SortAscending, SortDescending

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           Compare c)
Sort two arrays in ascending order, using one array for the keys. One array has the keys used for the sort, and another companion array is also sorted with the key array.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c - an object to that implements the comparison interface

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           Compare c,
                           int dir)
Sort two arrays in a specified order, using one array for the keys. One array has the keys used for the sort, and another companion array is also sorted with the key array.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c - an object to that implements the comparison interface
dir - the direction to sort the objects in. Must be SortAscending or SortDescending
See Also:
SortAscending, SortDescending

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           java.lang.Object[] c2,
                           Compare c)
Sort three arrays in ascending order, using one array for the keys. One array has the keys used for the sort, and the other two companion arrays are also sorted with the key array.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c2 - a companion array to sort in parallel with the array a. The values in c2 do not affect the sort.
c - an object to that implements the comparison interface

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           java.lang.Object[] c2,
                           Compare c,
                           int dir)
Sort three arrays in a specified order, using one array for the keys. One array has the keys used for the sort, and the other two companion arrays are also sorted with the key array.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c2 - a companion array to sort in parallel with the array a. The values in c2 do not affect the sort.
c - an object to that implements the comparison interface
dir - the direction to sort the objects in. Must be SortAscending or SortDescending
See Also:
SortAscending, SortDescending

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           java.lang.Object[] c2,
                           int first,
                           int n,
                           Compare c)
Sort a range of elements in three arrays in ascending order, using one array for the keys. Sorts elements first through first + n - 1 of the object array a, using the Compare object c to compare elements. The companion arrays c1 and c2 are also sorted in parallel with a.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c2 - a companion array to sort in parallel with the array a. The values in c2 do not affect the sort.
first - the first element to sort
n - the number of elements to sort
c - an object to that implements the comparison interface

objects

public static void objects(java.lang.Object[] a,
                           java.lang.Object[] c1,
                           java.lang.Object[] c2,
                           int first,
                           int n,
                           Compare c,
                           int dir)
Sort a range of elements in three arrays in a specified order, using one array for the keys. Sorts elements first through first + n - 1 of the object array a, using the Compare object c to compare elements. The companion arrays c1 and c2 are also sorted in parallel with a.

Parameters:
a - an array of objects to sort
c1 - a companion array to sort in parallel with the array a. The values in c1 do not affect the sort.
c2 - a companion array to sort in parallel with the array a. The values in c2 do not affect the sort.
first - the first element to sort
n - the number of elements to sort
c - an object to that implements the comparison interface
dir - the direction to sort the objects in. Must be SortAscending or SortDescending
See Also:
SortAscending, SortDescending

getSwapDirection

public static int getSwapDirection(int direction)
Returns the opposite of the given sort direction.

Parameters:
direction - either SortAscending or SortDescending
Returns:
the other direction
See Also:
SortAscending, SortDescending

reverseCompare

public static final Compare reverseCompare(Compare c)


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.