ftp.nice.ch/pub/next/database/apps/Stopwatch.2.5.s.tar.gz#/Stopwatch2.5/SortList.h

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

/*
 * For legal stuff see the file COPYRIGHT
 */
#import <objc/List.h>

@interface SortList : List
{
  id	delegate ;		// an object that knows how to compare elements 
  SEL	sortMethod;		// method used to sort
  SEL	compareMethod;		// method used to compare to key values
  SEL	valueMethod;		// method for getting key value
  id	compObject;		// object which will do actual comparison
  SEL	compMethod;		// method which will be used to do comparison
  BOOL	sorted;			// whether the list is sorted
  BOOL	autoSort;		// whether the list sorts itself automatically
}

// overridden methods
- initCount:(unsigned int)numSlots;
- (unsigned int)indexOf:anObject;
- addObject:anObject;
- addObjectIfAbsent:anObject;
- insertObject:anObject at:(unsigned int)index;
- replaceObject:anObject with:newObject;
- replaceObjectAt:(unsigned int)index with:newObject;

- update;
- (BOOL)isSorted;
- setAutoSort:(BOOL)sortFlag;
- (BOOL)doesAutoSort;

- setDelegate:obj;
- delegate;
- useSortMethod:(SEL)method;
- (SEL)sortMethod;
- useComparisonMethod:(SEL)method;
- (SEL)comparisonMethod;
- useValueMethod:(SEL)method;
- (SEL)valueMethod;

- sort;
- insertObject:anObject;
- mergeList:otherList;
- (unsigned int)indexOfObjectWithKey:proxyObject;

- shellsort;
- (int)compare:object1 :object2;

@end

@interface SortingListDelegate
/*
 * Delegated comparitor method.  Delegate must compare the two objects
 * and return a number < 0 if object1 < object2, 0 if object1 = object2, and a
 * number greater than 0 if object1 > object2 in whatever way makes sense to
 * the application.  The delegate can use the valueMethods already set or
 * ignore them and use its own.
 */
- (int)compare:object1 :object2;

/*
 * Delegated sort method (optional).  Delegate may implement its own sorting
 * routine (though it kinda defeats the whole purpose of this object).  The
 * SortList will send itself as the argument.  Note that the delegate can
 * access the comparisonMethods and valueMethods already assigned or can
 * ignore them and use its own.
 */
- sort:aList;
@end

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