swarm.simtools
Interface QSort
- All Known Implementing Classes:
- QSortImpl
- public interface QSort
- extends SwarmObject, SwarmObjectS
A class to sort a collection..
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.
Method Summary |
void |
reverseOrderOf(java.lang.Object aCollection)
The reverseOrderOf: method reverses the current order of a collection. |
void |
sortNumbersIn(java.lang.Object aCollection)
The sortNumbersIn: method performs integer comparisons on the objects in the collection using the default "compare" function. |
void |
sortObjectsIn(java.lang.Object aCollection)
The sortObjectsIn: method will sort the objects in the collection with the "compare' function for the object. |
void |
sortObjectsIn$using(java.lang.Object aCollection,
Selector aSelector)
The sortObjectsIn:using: method will sort the objects in the collection with the specified comparison function for the object. |
Methods inherited from interface swarm.defobj.Drop |
drop |
Methods inherited from interface swarm.defobj.DefinedObject |
compare,
describe,
describeID,
getDisplayName,
getTypeName,
getZone,
perform,
perform$with,
perform$with$with,
perform$with$with$with,
respondsTo,
setDisplayName,
xfprint,
xfprintid,
xprint,
xprintid |
sortObjectsIn
public void sortObjectsIn(java.lang.Object 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.
sortObjectsIn$using
public void sortObjectsIn$using(java.lang.Object aCollection,
Selector aSelector)
- The sortObjectsIn:using: method will sort the objects in the collection with the specified comparison function for the object.
sortNumbersIn
public void sortNumbersIn(java.lang.Object 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.
reverseOrderOf
public void reverseOrderOf(java.lang.Object 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.