This is ProgramServer.m in view mode; [Download] [Up]
#import "ProgramServer.h" #import "Program.h" @implementation ProgramServer - (id)init { NSCalendarDate *aDate; Program *aProgram; self = [super init]; programList = [[NSMutableArray alloc] init]; aDate = [NSCalendarDate dateWithString:@"8/13/1996 23:45" calendarFormat:@"%m/%d/%Y %H:%M"]; aProgram = [[Program alloc] initWithTitle:@"Faster, Pussycat, Kill Kill!" channel:@"Cinerip" broadcastDate:aDate cost:@"$2.50"]; [programList addObject:aProgram]; [aProgram release]; aDate = [NSCalendarDate dateWithString:@"8/14/1996 21:00" calendarFormat:@"%m/%d/%Y %H:%M"]; aProgram = [[Program alloc] initWithTitle:@"JFK" channel:@"The Conspiracy Channel" broadcastDate:aDate cost:@"$1.50"]; [programList addObject:aProgram]; [aProgram release]; aDate = [NSCalendarDate dateWithString:@"8/15/1996 19:00" calendarFormat:@"%m/%d/%Y %H:%M"]; aProgram = [[Program alloc] initWithTitle:@"It's a Wonderful Life" channel:@"Movie Classics" broadcastDate:aDate cost:@"$1.99"]; [programList addObject:aProgram]; [aProgram release]; return self; } - (void)dealloc { [programList autorelease]; [super dealloc]; return; } - (NSArray *)programs { // Guarantee bycopy transmission by making immutable. return [[programList copy] autorelease]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.