summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLTouchEvent.m
blob: 1094b9a0e30ee20f3891342f71b3970c9f7b196c (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<NSString *, id> *)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<NSNumber *> *)timeStamp {
    if (timeStamp != nil) {
        [store setObject:timeStamp forKey:NAMES_ts];
    } else {
        [store removeObjectForKey:NAMES_ts];
    }
}

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

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

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

@end