1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Globalization;
|
---|
6 |
|
---|
7 | namespace LoggingTool.models
|
---|
8 | {
|
---|
9 | class TeamUpQuestionnaire
|
---|
10 | {
|
---|
11 | private double timestamp;
|
---|
12 | private int playerID;
|
---|
13 | List<int> answers = new List<int>();
|
---|
14 |
|
---|
15 | /* ******************************************************************************
|
---|
16 | * constructor TeamUpQuestionnaire
|
---|
17 | * @description: creates a TeamUpQuestionnaire object out of the raw input String
|
---|
18 | * ******************************************************************************/
|
---|
19 | public TeamUpQuestionnaire(String rawInput)
|
---|
20 | {
|
---|
21 | //Split the inputstring on |, the delimiter used in the input format
|
---|
22 | String[] splitInput = rawInput.Split('|');
|
---|
23 | timestamp = double.Parse(splitInput[0], CultureInfo.InvariantCulture);
|
---|
24 | playerID = int.Parse(splitInput[1]);
|
---|
25 | for (int i = 2; i < splitInput.Count(); i++)
|
---|
26 | {
|
---|
27 | answers.Add(int.Parse(splitInput[i]));
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | /* ******************************************************************************
|
---|
32 | * function toString
|
---|
33 | * @return: String
|
---|
34 | * @description: Returns a string representation of the TeamUpQuestionnaire object
|
---|
35 | * ******************************************************************************/
|
---|
36 | public String toString()
|
---|
37 | {
|
---|
38 | String res = "Timestamp: +" + timestamp + "\n";
|
---|
39 | res = res + "PlayerID: + " + playerID + "\n";
|
---|
40 | for (int i = 0; i < answers.Count; i++)
|
---|
41 | {
|
---|
42 | res = res + "Answer to question " + i + ": " + answers[i] + "\n";
|
---|
43 | }
|
---|
44 | return res;
|
---|
45 | }
|
---|
46 |
|
---|
47 | /* ******************************************************************************
|
---|
48 | * function toStringArray
|
---|
49 | * @return: List<String>
|
---|
50 | * @description: Returns a String array containing the information of the TeamUpQuestionnaireObject
|
---|
51 | * ******************************************************************************/
|
---|
52 | public List<String> toStringArray()
|
---|
53 | {
|
---|
54 | List<String> res = new List<String>();
|
---|
55 | res.Add(timestamp.ToString());
|
---|
56 | res.Add(playerID.ToString());
|
---|
57 | for (int i = 0; i < answers.Count(); i++)
|
---|
58 | {
|
---|
59 | res.Add(answers[i].ToString());
|
---|
60 | }
|
---|
61 | return res;
|
---|
62 | }
|
---|
63 | }
|
---|
64 | }
|
---|