rt300@24
|
1 //
|
rt300@24
|
2 // Question.m
|
rt300@24
|
3 // sonicZoom
|
rt300@24
|
4 //
|
rt300@24
|
5 // Created by Robert Tubb on 21/01/2013.
|
rt300@24
|
6 //
|
rt300@24
|
7 //
|
rt300@24
|
8
|
rt300@24
|
9 #import "Question.h"
|
rt300@24
|
10
|
rt300@24
|
11 @implementation Question
|
rt300@24
|
12
|
rt300@24
|
13 @synthesize questionText = _questionText;
|
rt300@24
|
14 @synthesize questionType = _questionType;
|
rt300@24
|
15 @synthesize answer = _answer;
|
rt300@24
|
16
|
rt300@24
|
17 static int theCount = 0;
|
rt300@41
|
18 // WRONG
|
rt300@24
|
19 -(id)initWithTextAndType:(NSString *)text:(QuestionType)type{
|
rt300@24
|
20 self = [super init];
|
rt300@24
|
21 if(self){
|
rt300@24
|
22 self.questionText = text;
|
rt300@24
|
23 self.questionType = type;
|
rt300@29
|
24 self.answer = -1;
|
rt300@24
|
25 }
|
rt300@24
|
26
|
rt300@24
|
27 return self;
|
rt300@24
|
28
|
rt300@24
|
29 }
|
rt300@24
|
30 ////
|
rt300@24
|
31 - (id)init
|
rt300@24
|
32 {
|
rt300@24
|
33 return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE];
|
rt300@24
|
34 }
|
rt300@24
|
35
|
rt300@24
|
36 + (int) count { return theCount; }
|
rt300@24
|
37 + (void) setCount:(int)c { theCount = c; }
|
rt300@24
|
38
|
rt300@24
|
39
|
rt300@24
|
40
|
rt300@24
|
41 +(NSArray *)answersWithType:(QuestionType)type{
|
rt300@24
|
42 // get the set of answers depending on what type the q was
|
rt300@24
|
43 // pseudo static variable
|
rt300@24
|
44 if(type == AGREE_DISAGREE){
|
rt300@27
|
45 [Question setCount:NUM_CHOICES];
|
rt300@36
|
46
|
rt300@36
|
47 // potential leak
|
rt300@24
|
48 return [[NSArray alloc] initWithObjects:
|
rt300@27
|
49 @"Strongly agree",@"Agree", @"Neither agree nor disagree",
|
rt300@27
|
50 @"Disagree",@"Strongly disagree", nil];
|
rt300@24
|
51
|
rt300@24
|
52
|
rt300@24
|
53 }else if(type == SLIDERS_ZOOMER){
|
rt300@27
|
54 [Question setCount:NUM_CHOICES];
|
rt300@36
|
55 // potential leak
|
rt300@24
|
56 return [[NSArray alloc] initWithObjects:
|
rt300@31
|
57 @"definitely the Sliders", @"maybe the Sliders", @"Neither/Both equal",
|
rt300@27
|
58 @"maybe the Zoomer", @"definitely the Zoomer", nil];
|
rt300@24
|
59 }else{
|
rt300@24
|
60 return nil;
|
rt300@24
|
61 }
|
rt300@24
|
62 }
|
rt300@24
|
63 ///
|
rt300@24
|
64 @end
|