Documentation Set for Swarm 2.2
Prev | Reference VI. Simtools Library | Next

# QSort

## Name

QSort -- A class to sort a collection.

## Description

QSort is simply a "wrapper" for the C native "qsort" function, as applied to a Swarm collection. The values will appear in ascending order by default. Reversing the order of a collection can be made by calling reverseOrderOf. All these methods modify the underlying collection, so any indexes should always be regenerated.

## Protocols adopted by QSort

SwarmObject CREATABLE

## Methods

### Phase: Using

- + (void)reverseOrderOf: aCollection
  The reverseOrderOf: method reverses the current order of a collection. To make a "reversed" sort, simply call one of the appropriate "sort" methods on a collection then call this function on the same collection.

- + (void)sortNumbersIn: aCollection
  The sortNumbersIn: method performs integer comparisons on the objects in the collection using the default "compare" function. The default assumes that the numbers should be monotonically increasing.

- + (void)sortNumbersIn: aCollection using: (int (*) (const void*, const void*))comp_fun
  The sortNumbersIn:using: method performs integer comparisons on the objects in the collection with the specified comparison function for the object.

- + (void)sortObjectsIn: aCollection
  The sortObjectsIn: method will sort the objects in the collection with the "compare' function for the object. If the objects don't provide a compare function, sortObjectsIn uses the default from the defobj library.

- + (void)sortObjectsIn: aCollection using: (SEL)aSelector
  The sortObjectsIn:using: method will sort the objects in the collection with the specified comparison function for the object.

Prev | Home | Next
OutFile [Deprecated] | Up | UName