ftp.nice.ch/pub/next/developer/resources/libraries/threadkit/ThreadKitDemo.NI.tar.gz#/ThreadKit-1.0-DEMO/Examples/SortingInAction/GenericSort.h

This is GenericSort.h in view mode; [Download] [Up]

#import <objc/Object.h>
#import "SortController.h"
#import <stdlib.h>

#define SORTING_MSG 0	/* Constants to identify the different messages */
#define COMPARE_MSG 1  
#define SWAP_MSG 2  
#define MOVE_MSG 3
#define FINISHED_MSG 4

@interface GenericSort:Object
{
    char *sortName;			/* name of this sort */
    int sortNum;			/* unique integer for this sort */
    id sortView;			/* custom view to draw in */
    int numElements, *data;		/* size and array of data set */
    int compares, moves, fcalls;	/* counters for different operations */
    int compareVal, moveVal, fcallVal;	/* tick values for sort operations */
    int speedDelay;			/* mseconds delay between operations */
    BOOL animate;			/* should sort highlight compares? */
}

+ initialize;
- init;

/* TARGET-ACTION METHODS */
- setSize:(int)size address:(int*)address;
- setTicks:(int)value for:(int)tag;
- setAnimate:(BOOL)value;
- setSpeed:(int)value;

/* PRIVATE METHODS */
- (BOOL)lessThan:(int)position1 :(int)position2;
- swap:(int)position1 with:(int)position2;
- moveValue:(int)value to:(int)position;
- sortDone;
- adjust;
- abort;

/* PUBLIC METHODS */
- sort;
- (const char*)getName;
- view;
- (int)compares;
- (int)moves;
- (int)fcalls;
- (int)totalTicks;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.