summaryrefslogtreecommitdiff
path: root/SDL_iOS/SmartDeviceLinkProxy/Classes/RPC/SDLCreateInteractionChoiceSet.m
blob: dadccb7f67bfa2bde3348fb825ff921b2d9121f6 (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
//
// Copyright (c) 2013 Ford Motor Company
//

#import "SDLCreateInteractionChoiceSet.h"
#import "SDLNames.h"

@implementation SDLCreateInteractionChoiceSet

-(id) init {
    if (self = [super initWithName:NAMES_CreateInteractionChoiceSet]) {}
    return self;
}

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

-(void) setInteractionChoiceSetID:(NSNumber*) interactionChoiceSetID {
    if (interactionChoiceSetID != nil) {
        [parameters setObject:interactionChoiceSetID forKey:NAMES_interactionChoiceSetID];
    } else {
        [parameters removeObjectForKey:NAMES_interactionChoiceSetID];
    }
}

-(NSNumber*) interactionChoiceSetID {
    return [parameters objectForKey:NAMES_interactionChoiceSetID];
}

-(void) setChoiceSet:(NSMutableArray*) choiceSet {
    if (choiceSet != nil) {
        [parameters setObject:choiceSet forKey:NAMES_choiceSet];
    } else {
        [parameters removeObjectForKey:NAMES_choiceSet];
    }
}

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

@end