-
Notifications
You must be signed in to change notification settings - Fork 0
/
SampleEntityWithBitmasks.m
66 lines (54 loc) · 1.48 KB
/
SampleEntityWithBitmasks.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// SampleEntityWithBitmasks.m
// GTBitmask
//
// Created by Andrew Mackenzie-Ross on 17/12/10.
//
#import "SampleEntityWithBitmasks.h"
#import "GTBitmask.h"
@implementation SampleEntityWithBitmasks
@dynamic GTMorning;
@dynamic GTAfternoon;
@dynamic GTEvening;
@dynamic GTMonday;
@dynamic GTTuesday;
@dynamic GTWednesday;
@dynamic GTThursday;
@dynamic GTFriday;
@dynamic GTSaturday;
@dynamic GTSunday;
@dynamic name;
@dynamic daysOfTheWeekBitmask;
@dynamic partsOfTheDayBitmask;
- (void) setupBitmaks {
NSArray *dotw = [NSArray arrayWithObjects:@"GTMonday",@"GTTuesday",@"GTWednesday",@"GTThursday",@"GTFriday",@"GTSaturday",@"GTSunday",nil];
daysInTheWeek = [[GTBitmask alloc] initWithKeys:dotw];
daysInTheWeek.coreDataAttributeKey = @"daysOfTheWeekBitmask";
NSArray *potd = [NSArray arrayWithObjects:@"GTMorning",@"GTAfternoon",@"GTEvening",nil];
partsOfTheDay = [[GTBitmask alloc] initWithKeys:potd];
partsOfTheDay.coreDataAttributeKey = @"partsOfTheDayBitmask";
daysInTheWeek.bitmask = self.daysOfTheWeekBitmask;
partsOfTheDay.bitmask = self.partsOfTheDayBitmask;
}
-(void) awakeFromInsert {
[super awakeFromInsert];
[self setupBitmaks];
}
-(void) awakeFromFetch {
[super awakeFromFetch];
[self setupBitmaks];
}
- (void) didTurnIntoFault {
[daysInTheWeek release];
daysInTheWeek = nil;
[partsOfTheDay release];
partsOfTheDay = nil;
}
- (void) dealloc {
[super dealloc];
[daysInTheWeek release];
daysInTheWeek = nil;
[partsOfTheDay release];
partsOfTheDay = nil;
}
@end