-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatafile.java
More file actions
170 lines (134 loc) · 3.06 KB
/
Datafile.java
File metadata and controls
170 lines (134 loc) · 3.06 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package configuration;
import org.xmappr.Element;
import au.com.bytecode.opencsv.CSVWriter;
/**
* The Class Datafile.
* Elements from konfiguration.xml are loaded into here, into variables defined acc. to xml tag.
* Class for Tags konfiguration->inputfiles->datafile
*/
public class Datafile {
/** The data_id. */
@Element
public String data_id;
/** The path. */
@Element
public String path;
/** The type. */
@Element
public String type;
/** The is_sorted. */
@Element(defaultValue="false")
public boolean is_sorted;
/** The id field. */
@Element(defaultValue="PID")
public String idfield;
@Element(defaultValue="false")
public boolean leadingtable;
@Element
public String leadingtable_columns;
@Element
public String leadingtable_numfield;
@Element
public String addinfo;
@Element
public String separator;
@Element
public String quote;
/**
* Checks if is sorted.
*
* @return true, if is sorted
*/
public boolean isSorted() {
return is_sorted;
}
/**
* Sets the checks if is sorted.
*
* @param b the new checks if is sorted
*/
public void setIsSorted(boolean b) {
is_sorted=b;
}
/**
* Gets the data_id.
*
* @return the data_id
*/
public String getDatentyp() {
return data_id.toUpperCase();
}
/**
* Gets the path.
*
* @return the path
*/
public String getPath() {
return path;
}
/**
* Sets the path.
*
* @param p the new path
*/
public void setPath(String p) {
path = p;
}
/**
* Gets the filetype.
*
* @return the filetype
*/
public String getFiletype() {
return type.toUpperCase();
}
/**
* Sets the filetype.
*
* @param f the new filetype
*/
public void setFiletype(String f) {
type = f;
}
public String[] getIdfeld() {
if (idfield==null) idfield = "PID";
String[] tokens = idfield.toUpperCase().split(Consts.fieldcombineseparator);
return tokens;
}
public boolean hasZusatzinfo() {
return (addinfo != null && !addinfo.equals(""));
}
public String getZusatzinfo() {
if (addinfo != null) return addinfo;
return "";
}
public boolean isLeadingTable() {
return leadingtable;
}
public boolean hasSpecificColumns() {
if (leadingtable_columns==null) return false;
else return true;
}
public String[] getSpecificColumns() {
String[] tokens = null;
if (leadingtable_columns==null) return tokens;
tokens = leadingtable_columns.split(Consts.fieldcombineseparator);
return tokens;
}
public boolean hasNumfield() {
if (leadingtable_numfield==null) return false;
else return true;
}
public String getNumfield() {
return leadingtable_numfield;
}
public char getSeparator(){
if (separator == null) return Consts.csvfieldseparator.charAt(0);
return separator.charAt(0);
}
public char getQuote(){
//if (quote == null) return '"';
if (quote == null || quote.length()==0) return CSVWriter.NO_QUOTE_CHARACTER;
return quote.charAt(0);
}
}