Revize 98b568bc
Přidáno uživatelem Alex Konig před téměř 4 roky(ů)
Server/ServerApp/Parser/Parsers/LogInParser.cs | ||
---|---|---|
10 | 10 |
/// Class parsing login files into instances of ActivityInfo divided by given time interval |
11 | 11 |
/// Data parsed from 7am (included) to 18pm (included) |
12 | 12 |
/// </summary> |
13 |
/// <author>Alex Konig</author> |
|
13 | 14 |
class LogInParser |
14 | 15 |
{ |
16 |
/// <summary> Datafile loader </summary> |
|
17 |
DataLoader loader; |
|
18 |
|
|
19 |
/// <summary> |
|
20 |
/// Constructor |
|
21 |
/// </summary> |
|
22 |
/// <param name="loader">Datafile loader</param> |
|
23 |
public LogInParser(DataLoader loader) |
|
24 |
{ |
|
25 |
this.loader = loader; |
|
26 |
} |
|
27 |
|
|
15 | 28 |
/// <summary> |
16 | 29 |
/// Parses login data to ActivityInfo instances |
17 | 30 |
/// Data parsed from 7am (included) to 18pm (included) |
... | ... | |
51 | 64 |
/// </summary> |
52 | 65 |
/// <param name="path">Path ti file</param> |
53 | 66 |
/// <returns>List with ActivityInfo instances</returns> |
54 |
private static List<ActivityInfo> ProcessOneLogInFileAsDays(string path)
|
|
67 |
private List<ActivityInfo> ProcessOneLogInFileAsDays(string path) |
|
55 | 68 |
{ |
56 | 69 |
if (!File.Exists(path)) |
57 | 70 |
return null; |
58 | 71 |
|
59 | 72 |
List<ActivityInfo> loginInfo = new List<ActivityInfo>(); |
60 |
List<LogInInstance> list = CsvDataLoader.LoadLoginFile(path);
|
|
73 |
List<LogInInstance> list = loader.LoadLoginFile(path);
|
|
61 | 74 |
|
62 | 75 |
// data for each faculty |
63 | 76 |
int[] recordedAmount = new int[TagInfo.faculties.Length]; |
... | ... | |
126 | 139 |
return loginInfo; |
127 | 140 |
} |
128 | 141 |
|
129 |
private static List<ActivityInfo> ProcessOneLoginFileAsIntervals(string path, int interval) |
|
142 |
/// <summary> |
|
143 |
/// Parses data from one data file as one instance per interval length |
|
144 |
/// </summary> |
|
145 |
/// <param name="path">Path to file</param> |
|
146 |
/// <param name="interval">Interval length</param> |
|
147 |
/// <returns>List with ActivityInfo instances</returns> |
|
148 |
private List<ActivityInfo> ProcessOneLoginFileAsIntervals(string path, int interval) |
|
130 | 149 |
{ |
131 | 150 |
if (!File.Exists(path)) |
132 | 151 |
return null; |
133 | 152 |
|
134 | 153 |
List<ActivityInfo> loignInfo = new List<ActivityInfo>(); |
135 |
List<LogInInstance> list = CsvDataLoader.LoadLoginFile(path);
|
|
154 |
List<LogInInstance> list = loader.LoadLoginFile(path);
|
|
136 | 155 |
|
137 |
// data for each faculty |
|
138 |
int[] recordedAmount = new int[TagInfo.faculties.Length]; |
|
139 | 156 |
// min/max hour taken into account |
140 | 157 |
int[] minmaxHour = new int[] { 7, 18 }; |
141 | 158 |
int range = minmaxHour[1] - minmaxHour[0]; |
Také k dispozici: Unified diff
re #8612 Weather parser in hourly intervals