summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLTouchEvent.m
blob: e54e8b79ec95785d25ed4974133a9374d6c3065a (plain)
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
67
68
69
//  SDLTouchEvent.m
//


#import "SDLTouchEvent.h"

#import "SDLNames.h"
#import "SDLTouchCoord.h"

@implementation SDLTouchEvent

- (instancetype)init {
    if (self = [super init]) {
    }
    return self;
}

- (instancetype)initWithDictionary:(NSMutableDictionary *)dict {
    if (self = [super initWithDictionary:dict]) {
    }
    return self;
}

- (void)setTouchEventId:(NSNumber *)touchEventId {
    if (touchEventId != nil) {
        [store setObject:touchEventId forKey:NAMES_id];
    } else {
        [store removeObjectForKey:NAMES_id];
    }
}

- (NSNumber *)touchEventId {
    return [store objectForKey:NAMES_id];
}

- (void)setTimeStamp:(NSMutableArray *)timeStamp {
    if (timeStamp != nil) {
        [store setObject:timeStamp forKey:NAMES_ts];
    } else {
        [store removeObjectForKey:NAMES_ts];
    }
}

- (NSMutableArray *)timeStamp {
    return [store objectForKey:NAMES_ts];
}

- (void)setCoord:(NSMutableArray *)coord {
    if (coord != nil) {
        [store setObject:coord forKey:NAMES_c];
    } else {
        [store removeObjectForKey:NAMES_c];
    }
}

- (NSMutableArray *)coord {
    NSMutableArray *array = [store objectForKey:NAMES_c];
    if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLTouchCoord.class]) {
        return array;
    } else {
        NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]];
        for (NSDictionary *dict in array) {
            [newList addObject:[[SDLTouchCoord alloc] initWithDictionary:(NSMutableDictionary *)dict]];
        }
        return newList;
    }
}

@end