comparison backend/src/main/java/org/dive4elements/river/importer/parsers/AbstractSedimentLoadParser.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 7bc675e4e6e0
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8855:d7c005e12af0 8856:5e38e2924c07
33 33
34 private static final Logger log = 34 private static final Logger log =
35 Logger.getLogger(AbstractSedimentLoadParser.class); 35 Logger.getLogger(AbstractSedimentLoadParser.class);
36 36
37 37
38 public static final NumberFormat nf = NumberFormat.getInstance(DEFAULT_LOCALE); 38 public static final NumberFormat nf = NumberFormat.getInstance(
39 DEFAULT_LOCALE);
39 40
40 41
41 public static final Pattern TIMEINTERVAL_SINGLE = 42 public static final Pattern TIMEINTERVAL_SINGLE =
42 Pattern.compile("\\D*([0-9]+?)\\D*"); 43 Pattern.compile("\\D*([0-9]+?)\\D*");
43 44
90 super.parse(file); 91 super.parse(file);
91 } 92 }
92 93
93 94
94 @Override 95 @Override
95 protected void handleLine(int lineNum, String line) throws LineParserException { 96 protected void handleLine(int lineNum, String line)
97 throws LineParserException {
96 if (line.startsWith(START_META_CHAR)) { 98 if (line.startsWith(START_META_CHAR)) {
97 handleMetaLine(stripMetaLine(line)); 99 handleMetaLine(stripMetaLine(line));
98 } 100 }
99 else { 101 else {
100 handleDataLine(line); 102 handleDataLine(line);
123 125
124 return false; 126 return false;
125 } 127 }
126 128
127 129
128 public boolean handleMetaFractionName(String line) throws LineParserException { 130 public boolean handleMetaFractionName(String line)
131 throws LineParserException {
129 Matcher m = META_FRACTION_NAME.matcher(line); 132 Matcher m = META_FRACTION_NAME.matcher(line);
130 133
131 if (m.matches()) { 134 if (m.matches()) {
132 String name = m.group(1); 135 String name = m.group(1);
133 136
134 137
135 GrainFraction gf = ImporterSession.getInstance().getGrainFraction(name); 138 GrainFraction gf = ImporterSession.getInstance()
139 .getGrainFraction(name);
136 140
137 if (gf != null) { 141 if (gf != null) {
138 142
139 if (lower != null && upper != null) { 143 if (lower != null && upper != null) {
140 // Validate grain size interval 144 // Validate grain size interval
144 148
145 if (EpsilonComparator.CMP.compare(lowval, 149 if (EpsilonComparator.CMP.compare(lowval,
146 gf.getLower()) != 0 || 150 gf.getLower()) != 0 ||
147 EpsilonComparator.CMP.compare(upval, 151 EpsilonComparator.CMP.compare(upval,
148 gf.getUpper()) != 0) { 152 gf.getUpper()) != 0) {
149 log.warn("ASLP: Invalid grain size for grain fraction '" + 153 log.warn(
150 name + "'. Ignored."); 154 "ASLP: Invalid grain size for grain fraction '"
155 + name + "'. Ignored.");
151 } 156 }
152 } 157 }
153 catch (ParseException pe) { 158 catch (ParseException pe) {
154 log.warn("ASLP: Could not parse grain-size interval. Ignored."); 159 log.warn("ASLP: Could not parse grain-size interval. "
160 + "Ignored.");
155 } 161 }
156 } 162 }
157 163
158 grainFraction = new ImportGrainFraction(gf); 164 grainFraction = new ImportGrainFraction(gf);
159 return true; 165 return true;
238 244
239 Matcher b = TIMEINTERVAL_SINGLE.matcher(column); 245 Matcher b = TIMEINTERVAL_SINGLE.matcher(column);
240 if (b.matches()) { 246 if (b.matches()) {
241 int year = nf.parse(b.group(1)).intValue(); 247 int year = nf.parse(b.group(1)).intValue();
242 248
243 return new ImportTimeInterval(DateUtil.getStartDateFromYear(year)); 249 return new ImportTimeInterval(
250 DateUtil.getStartDateFromYear(year));
244 } 251 }
245 252
246 log.warn("ASLP: Unknown time interval string: '" + column + "'"); 253 log.warn("ASLP: Unknown time interval string: '" + column + "'");
247 } 254 }
248 catch (ParseException pe) { 255 catch (ParseException pe) {

http://dive4elements.wald.intevation.org