|
|
Sample Programs from NeXSTEP 3.3
#import <objc/Object.h>
#define BUBBLE_SORT 0 /* Unique constants for each sort */
#define INSERTION_SORT 1
#define MERGE_SORT 2
#define QUICK_SORT 3
#define SELECTION_SORT 4
#define SHELL_SORT 5
#define NUM_SORT_TYPES 6
@interface SortController:Object
{
id sortWindow; /* window that display sorting */
id windowHeader; /* Box object of window header */
id sort[NUM_SORT_TYPES]; /* array of sort objects */
BOOL sortOn[NUM_SORT_TYPES];/* array of booleans for sorts on/off */
BOOL parallel; /* boolean to signal series or parallel */
int numSorts; /* number of sorts scheduled for this trial */
int sortsFinished; /* number of sorts finished in this trial */
int numElements; /* number of elements in the data set */
int percentSorted; /* percentage of the data that is pre-sorted */
}
/* INIT METHODS */
- init;
/* TARGET-ACTION METHODS */
- changeAnimate:sender;
- changeDataSet:sender;
- changeParallel:sender;
- changeSortOn:sender;
- changeTickValue:sender;
/* TEXT DELEGATE METHODS */
- (BOOL)textWillEnd:textObject;
/* PRIVATE METHODS */
- setUpWindow;
- (int *)newDataSet;
- setUpData;
/* PUBLIC METHODS */
- (BOOL)startSort;
- sortFinished:(int)sortNum;
- findSortWithNum:(int)sortNum;
@end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.