home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / RZToDoList / Source / RZBrowserCell.subproj / RZSortedList.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  924 b   |  39 lines

  1. /* 
  2.  * RZSortedList - support object for the RZBrowserCell, a List that
  3.  *     can sort itself in a generic way (it depends on its constituent
  4.  *        objects to conform to the RZSortableObjects protocol)
  5.  *
  6.  * You may freely copy, distribute and reuse the code in this example.
  7.  * This code is provided AS IS without warranty of any kind, expressed 
  8.  * or implied, as to its fitness for any particular use.
  9.  *
  10.  * Copyright 1995 Ralph Zazula (rzazula@next.com).  All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. #import "RZSortedList.h"
  15.  
  16. @implementation RZSortedList
  17.  
  18. - insertObject:anObject at:(unsigned)index
  19. {
  20.     return [self notImplemented:_cmd];
  21. }
  22.  
  23. - replaceObjectAt:(unsigned)index with:newObject
  24. {
  25.     return [self notImplemented:_cmd];
  26. }
  27.  
  28. - addObject:(id <RZSortableObjects>)anObject
  29. {
  30.     int i = 0;
  31.     while(i < numElements && 
  32.         ([anObject sortIndex] >= [[self objectAt:i] sortIndex])) {
  33.         i++;
  34.     }
  35.     return [super insertObject:anObject at:i];
  36. }
  37.  
  38. @end
  39.