-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelVariableReadIn.java
More file actions
72 lines (61 loc) · 2.2 KB
/
ModelVariableReadIn.java
File metadata and controls
72 lines (61 loc) · 2.2 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package models;
import java.util.HashMap;
import configuration.Consts;
/**
* The Class ModelVariableReadIn.
* Just for reading in Strings from csv-row, and returning as needed (e.e. uppercase if needed)
* Non-Uppercase for filters only!
*
*
*/
public class ModelVariableReadIn {
//private final static Logger LOGGER = Logger.getLogger(ModelVariableReadIn.class.getName());
private HashMap<String,String> myrow;
private String[] columns;
private String[] filters;
public ModelVariableReadIn(HashMap<String,String> myrow, int filtercolumns, InputFile myinputfile) throws ModelConfigException {
this.myrow = myrow;
columns = new String[filtercolumns];
filters = new String[filtercolumns];
for (int j=0; j<filtercolumns; j++) {
columns[j]=myrow.get(Consts.modColumnCol + (j+1)).toUpperCase();
filters[j]=myrow.get(Consts.modColfilterCol + (j+1));
if (!columns[j].isEmpty() && !myinputfile.hasField(columns[j].split(Consts.bracketEsc)[0]))
throw new ModelConfigException("Fehler bei Variable "+ myrow.get(Consts.modVariableCol) + ": "+ columns[j] + " existiert nicht in File "+ myinputfile.getDatentyp());
}
}
public String getVariableCol() {
return this.myrow.get(Consts.modVariableCol).toUpperCase();
}
public String getCalcCol() {
return this.myrow.get(Consts.modCalcCol).toUpperCase();
}
public String getAggCol() {
return this.myrow.get(Consts.modAggCol).toUpperCase();
}
public String getFilterCol() {
return this.myrow.get(Consts.modFilterCol);
}
public String getSet1Col() {
if (this.myrow.get(Consts.modSet1Col) != null) return this.myrow.get(Consts.modSet1Col).toUpperCase();
else return null;
}
public String getIncludeCol() {
return this.myrow.get(Consts.modIncludeCol).toUpperCase();
}
public String getExcludeCol() {
return this.myrow.get(Consts.modExcludeCol).toUpperCase();
}
public String getTargetCol() {
return this.myrow.get(Consts.modTargetCol).toUpperCase();
}
public String getHideCol() {
return this.myrow.get(Consts.modHideCol).toUpperCase();
}
public String[] getColumns() {
return this.columns;
}
public String[] getFilters() {
return this.filters;
}
}