|
@@ -12,25 +12,44 @@ public class Application {
|
12
|
12
|
|
13
|
13
|
public static void main(String [] args)
|
14
|
14
|
{
|
15
|
|
- Trait vExtrovertTrait = new Trait("Extrovert", "You're an extrovert");
|
16
|
|
- Trait vIntrovertTrait = new Trait("Introvert", "You're an introvert");
|
17
|
|
- Trait vDogTrait = new Trait("Dog", "You're a dog");
|
|
15
|
+
|
|
16
|
+ Questionnaire vQuestionnaire = getQuestionnaire();
|
|
17
|
+ //------------------------------------
|
|
18
|
+ // Start server
|
|
19
|
+ //------------------------------------
|
|
20
|
+ try {
|
|
21
|
+ HttpServer vServer = HttpServer.create(new InetSocketAddress(8080), 0);
|
|
22
|
+ vServer.createContext("/", new ResponseHandler());
|
|
23
|
+ vServer.setExecutor(null);
|
|
24
|
+ vServer.start();
|
|
25
|
+ }
|
|
26
|
+ catch(Exception ve)
|
|
27
|
+ {
|
|
28
|
+ ve.printStackTrace();
|
|
29
|
+ }
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ public static Questionnaire getQuestionnaire()
|
|
33
|
+ {
|
|
34
|
+ Trait vExtrovertTrait = new Trait("Extrovert", "You're an extrovert.");
|
|
35
|
+ Trait vIntrovertTrait = new Trait("Introvert", "You're an introvert.");
|
|
36
|
+ Trait vDogTrait = new Trait("Dog", "You're a dog that appears to know how to read.");
|
18
|
37
|
|
19
|
38
|
//------------------------------------
|
20
|
39
|
// Define questionnaire
|
21
|
40
|
//------------------------------------
|
22
|
|
- Questionnaire vQuestionnaire = new Questionnaire(
|
|
41
|
+ return new Questionnaire(
|
23
|
42
|
"Introvert or extrovert ?",
|
24
|
43
|
Arrays.asList(
|
25
|
44
|
//------------------------------------
|
26
|
45
|
// First question
|
27
|
46
|
//------------------------------------
|
28
|
47
|
new Question(
|
29
|
|
- "You're really busy at work and a colleague is telling you their life story and personal woes.",
|
|
48
|
+ "You're really busy at work and a colleague is telling you their life story and personal woes, you :",
|
30
|
49
|
Arrays.asList(
|
31
|
50
|
new Answer("Don't dare to interrupt them", vIntrovertTrait, 0.5f),
|
32
|
|
- new Answer("Think it's more important to give them some of your time; work can wait", vIntrovertTrait, 0.2f),
|
33
|
|
- new Answer("Listen, but with only with half an ear ", vIntrovertTrait, 0.1f),
|
|
51
|
+ new Answer("Think it's more important to give them some of your time; work can wait", vExtrovertTrait, 0.2f),
|
|
52
|
+ new Answer("Listen, but with only with half an ear ", vIntrovertTrait, 0.2f),
|
34
|
53
|
new Answer("Try to show interest despite being busy chasing your tail", vDogTrait, 0.8f),
|
35
|
54
|
new Answer("Interrupt and explain that you are really busy at the moment", vExtrovertTrait, 0.5f)
|
36
|
55
|
)
|
|
@@ -39,70 +58,51 @@ public class Application {
|
39
|
58
|
// Second question
|
40
|
59
|
//------------------------------------
|
41
|
60
|
new Question(
|
42
|
|
- "You've been sitting in the doctor's waiting room for more than 25 minutes.",
|
|
61
|
+ "You've been sitting in the doctor's waiting room for more than 25 minutes, you :",
|
43
|
62
|
Arrays.asList(
|
44
|
63
|
new Answer("Look at your watch every two minutes", vIntrovertTrait, 0.2f),
|
45
|
64
|
new Answer("Bubble with inner anger, but keep quiet ", vIntrovertTrait, 0.5f),
|
46
|
65
|
new Answer("Explain to other equally impatient people in the room that the doctor is always running late ", vExtrovertTrait, 0.3f),
|
47
|
66
|
new Answer("Complain in a loud voice, while tapping your foot impatiently", vExtrovertTrait, 0.7f),
|
48
|
|
- new Answer("Befriend the teckel sitting next to you", vExtrovertTrait, 0.7f)
|
|
67
|
+ new Answer("Befriend the teckel sitting next to you", vDogTrait, 0.7f)
|
49
|
68
|
)
|
50
|
69
|
),
|
51
|
70
|
//------------------------------------
|
52
|
71
|
// Third question
|
53
|
72
|
//------------------------------------
|
54
|
73
|
new Question(
|
55
|
|
- "Blah blah blah ? Blah.",
|
|
74
|
+ "How do you usually answer affirmatively ?",
|
56
|
75
|
Arrays.asList(
|
57
|
76
|
new Answer("Yes.", vIntrovertTrait, 0.2f),
|
58
|
77
|
new Answer("Woof", vDogTrait, 0.7f),
|
59
|
|
- new Answer("Sure", vExtrovertTrait, 0.3f),
|
60
|
|
- new Answer("Meh", vExtrovertTrait, 0.7f)
|
61
|
|
-
|
|
78
|
+ new Answer("Absolutely !", vExtrovertTrait, 0.3f)
|
62
|
79
|
)
|
63
|
80
|
),
|
64
|
81
|
//------------------------------------
|
65
|
82
|
// Fourth question
|
66
|
83
|
//------------------------------------
|
67
|
84
|
new Question(
|
68
|
|
- "Blah blah blah ? Blah.",
|
|
85
|
+ "When receiving guests, you don't appreciate :",
|
69
|
86
|
Arrays.asList(
|
70
|
|
- new Answer("Yes.", vIntrovertTrait, 0.2f),
|
71
|
|
- new Answer("Woof", vDogTrait, 0.7f),
|
72
|
|
- new Answer("Sure", vExtrovertTrait, 0.3f),
|
73
|
|
- new Answer("Meh", vExtrovertTrait, 0.7f)
|
74
|
|
-
|
|
87
|
+ new Answer("People that don't feed the conversation.", vExtrovertTrait, 0.2f),
|
|
88
|
+ new Answer("Cats.", vDogTrait, 0.7f),
|
|
89
|
+ new Answer("Being the center of attention.", vIntrovertTrait, 0.3f)
|
75
|
90
|
)
|
76
|
91
|
),
|
77
|
92
|
//------------------------------------
|
78
|
93
|
// Fifth question
|
79
|
94
|
//------------------------------------
|
80
|
95
|
new Question(
|
81
|
|
- "Blah blah blah ? Blah.",
|
|
96
|
+ "You can't find the keys to your car.",
|
82
|
97
|
Arrays.asList(
|
83
|
|
- new Answer("Yes.", vIntrovertTrait, 0.2f),
|
84
|
|
- new Answer("Woof", vDogTrait, 0.7f),
|
85
|
|
- new Answer("Sure", vExtrovertTrait, 0.3f),
|
86
|
|
- new Answer("Meh", vExtrovertTrait, 0.7f)
|
|
98
|
+ new Answer("You search desperately without asking for help", vIntrovertTrait, 0.2f),
|
|
99
|
+ new Answer("You get everyone here to look with you.", vExtrovertTrait, 0.2f),
|
|
100
|
+ new Answer("You don't need to worry about car keys because you can't drive a car with your paws.", vDogTrait, 0.7f)
|
87
|
101
|
|
88
|
102
|
)
|
89
|
103
|
)
|
90
|
104
|
)
|
91
|
105
|
);
|
92
|
|
-
|
93
|
|
- //------------------------------------
|
94
|
|
- // Start server
|
95
|
|
- //------------------------------------
|
96
|
|
- try {
|
97
|
|
- HttpServer vServer = HttpServer.create(new InetSocketAddress(8080), 0);
|
98
|
|
- vServer.createContext("/", new ResponseHandler());
|
99
|
|
- vServer.setExecutor(null);
|
100
|
|
- vServer.start();
|
101
|
|
- }
|
102
|
|
- catch(Exception ve)
|
103
|
|
- {
|
104
|
|
- ve.printStackTrace();
|
105
|
|
- }
|
106
|
106
|
}
|
107
|
107
|
|
108
|
108
|
}
|