comparison artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java @ 8951:322b0e6298ea

Work on SINFO FlowDepth-Development
author gernotbelger
date Fri, 16 Mar 2018 18:08:38 +0100
parents 5b5bdce5a216
children fb9430250899
comparison
equal deleted inserted replaced
8950:b0aeed4c97c1 8951:322b0e6298ea
7 */ 7 */
8 8
9 package org.dive4elements.river.utils; 9 package org.dive4elements.river.utils;
10 10
11 import java.text.DateFormat; 11 import java.text.DateFormat;
12 import java.text.DecimalFormat;
12 import java.text.NumberFormat; 13 import java.text.NumberFormat;
13 import java.text.SimpleDateFormat; 14 import java.text.SimpleDateFormat;
14 import java.text.DecimalFormat;
15 import java.util.Locale; 15 import java.util.Locale;
16 16
17 import org.dive4elements.artifacts.CallContext; 17 import org.dive4elements.artifacts.CallContext;
18 import org.dive4elements.artifacts.CallMeta; 18 import org.dive4elements.artifacts.CallMeta;
19 import org.dive4elements.river.artifacts.resources.Resources; 19 import org.dive4elements.river.artifacts.resources.Resources;
109 * @param min minimum number of decimal ("fraction") digits. 109 * @param min minimum number of decimal ("fraction") digits.
110 * @param max maximum number of decimal ("fraction") digits. 110 * @param max maximum number of decimal ("fraction") digits.
111 * @return A NumberFormat. Use #format(NUMBER) to get String representation 111 * @return A NumberFormat. Use #format(NUMBER) to get String representation
112 * of NUMBER. 112 * of NUMBER.
113 */ 113 */
114 public static NumberFormat getFormatter(CallMeta m, int min, int max){ 114 public static NumberFormat getFormatter(final CallMeta m, final int min, final int max){
115 Locale locale = Resources.getLocale(m); 115 final Locale locale = Resources.getLocale(m);
116 NumberFormat nf = NumberFormat.getInstance(locale); 116 final NumberFormat nf = NumberFormat.getInstance(locale);
117 117
118 nf.setMaximumFractionDigits(max); 118 nf.setMaximumFractionDigits(max);
119 nf.setMinimumFractionDigits(min); 119 nf.setMinimumFractionDigits(min);
120 120
121 return nf; 121 return nf;
122 } 122 }
123 123
124 public static NumberFormat getFormatter(CallContext c, int min, int max){ 124 public static NumberFormat getFormatter(final CallContext c, final int min, final int max){
125 return getFormatter(c.getMeta(), min, max); 125 return getFormatter(c.getMeta(), min, max);
126 } 126 }
127 127
128 128
129 /** 129 /**
131 * 131 *
132 * @param c The CallContext. 132 * @param c The CallContext.
133 * 133 *
134 * @return a number formatter. 134 * @return a number formatter.
135 */ 135 */
136 public static NumberFormat getRawFormatter(CallContext c) { 136 public static NumberFormat getRawFormatter(final CallContext c) {
137 Locale locale = Resources.getLocale(c.getMeta()); 137 final Locale locale = Resources.getLocale(c.getMeta());
138 return NumberFormat.getInstance(locale); 138 return NumberFormat.getInstance(locale);
139 } 139 }
140 140
141 /** 141 /**
142 * Returns a formatter in engineering notation. 142 * Returns a formatter in engineering notation.
143 */ 143 */
144 public static NumberFormat getEngFormatter(CallContext c) { 144 public static NumberFormat getEngFormatter(final CallContext c) {
145 NumberFormat nf = getRawFormatter(c); 145 final NumberFormat nf = getRawFormatter(c);
146 if (nf instanceof DecimalFormat) { 146 if (nf instanceof DecimalFormat) {
147 DecimalFormat df = (DecimalFormat)nf; 147 final DecimalFormat df = (DecimalFormat)nf;
148 df.applyPattern("##0.#####E0"); 148 df.applyPattern("##0.#####E0");
149 } 149 }
150 return nf; 150 return nf;
151 } 151 }
152 152
153 /** 153 /**
154 * Returns a number formatter that uses an exponent after max digits. 154 * Returns a number formatter that uses an exponent after max digits.
155 */ 155 */
156 public static NumberFormat getScientificFormater( 156 public static NumberFormat getScientificFormater(
157 CallContext c, 157 final CallContext c,
158 int min, 158 final int min,
159 int max 159 final int max
160 ) { 160 ) {
161 NumberFormat nf = getRawFormatter(c); 161 final NumberFormat nf = getRawFormatter(c);
162 if (nf instanceof DecimalFormat) { 162 if (nf instanceof DecimalFormat) {
163 DecimalFormat df = (DecimalFormat)nf; 163 final DecimalFormat df = (DecimalFormat)nf;
164 df.applyPattern("0.0E0"); 164 df.applyPattern("0.0E0");
165 df.setMaximumFractionDigits(max); 165 df.setMaximumFractionDigits(max);
166 df.setMinimumFractionDigits(min); 166 df.setMinimumFractionDigits(min);
167 } 167 }
168 return nf; 168 return nf;
170 170
171 171
172 /** 172 /**
173 * Returns a date formatter with SHORT style. 173 * Returns a date formatter with SHORT style.
174 */ 174 */
175 public static DateFormat getShortDateFormat(CallContext cc) { 175 public static DateFormat getShortDateFormat(final CallContext cc) {
176 Locale locale = Resources.getLocale(cc.getMeta()); 176 final Locale locale = Resources.getLocale(cc.getMeta());
177 return DateFormat.getDateInstance(DateFormat.SHORT, locale); 177 return DateFormat.getDateInstance(DateFormat.SHORT, locale);
178 } 178 }
179 179
180 180
181 /** 181 /**
182 * Returns a date formatter with MEDIUM style. 182 * Returns a date formatter with MEDIUM style.
183 */ 183 */
184 public static DateFormat getMediumDateFormat(CallContext cc) { 184 public static DateFormat getMediumDateFormat(final CallContext cc) {
185 Locale locale = Resources.getLocale(cc.getMeta()); 185 final Locale locale = Resources.getLocale(cc.getMeta());
186 return DateFormat.getDateInstance(DateFormat.MEDIUM, locale); 186 return DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
187 } 187 }
188 188
189 189
190 /** 190 /**
191 * Returns the number formatter for kilometer values in waterlevel exports. 191 * Returns the number formatter for kilometer values in waterlevel exports.
192 * 192 *
193 * @return the number formatter for kilometer values. 193 * @return the number formatter for kilometer values.
194 */ 194 */
195 public static NumberFormat getWaterlevelKM(CallContext context) { 195 public static NumberFormat getWaterlevelKM(final CallContext context) {
196 return getFormatter( 196 return getFormatter(
197 context, 197 context,
198 WATERLEVEL_KM_MIN_DIGITS, 198 WATERLEVEL_KM_MIN_DIGITS,
199 WATERLEVEL_KM_MAX_DIGITS); 199 WATERLEVEL_KM_MAX_DIGITS);
200 } 200 }
203 * Returns the number formatter for data exported from diagram (not from 203 * Returns the number formatter for data exported from diagram (not from
204 * calculation. 204 * calculation.
205 * 205 *
206 * @return the number formatter for csv data from diagra. 206 * @return the number formatter for csv data from diagra.
207 */ 207 */
208 public static NumberFormat getCSVFormatter(CallContext context) { 208 public static NumberFormat getCSVFormatter(final CallContext context) {
209 return getFormatter( 209 return getFormatter(
210 context, 210 context,
211 CSV_DIAGRAM_DATA_MIN_DIGITS, 211 CSV_DIAGRAM_DATA_MIN_DIGITS,
212 CSV_DIAGRAM_DATA_MAX_DIGITS); 212 CSV_DIAGRAM_DATA_MAX_DIGITS);
213 } 213 }
214 214
215 public static NumberFormat getWaterlevelW(CallMeta meta) { 215 public static NumberFormat getWaterlevelW(final CallMeta meta) {
216 return getFormatter( 216 return getFormatter(
217 meta, 217 meta,
218 WATERLEVEL_W_MIN_DIGITS, 218 WATERLEVEL_W_MIN_DIGITS,
219 WATERLEVEL_W_MAX_DIGITS); 219 WATERLEVEL_W_MAX_DIGITS);
220 } 220 }
223 /** 223 /**
224 * Returns the number formatter for W values in waterlevel exports. 224 * Returns the number formatter for W values in waterlevel exports.
225 * 225 *
226 * @return the number formatter for W values. 226 * @return the number formatter for W values.
227 */ 227 */
228 public static NumberFormat getWaterlevelW(CallContext context) { 228 public static NumberFormat getWaterlevelW(final CallContext context) {
229 return getFormatter( 229 return getFormatter(
230 context, 230 context,
231 WATERLEVEL_W_MIN_DIGITS, 231 WATERLEVEL_W_MIN_DIGITS,
232 WATERLEVEL_W_MAX_DIGITS); 232 WATERLEVEL_W_MAX_DIGITS);
233 } 233 }
236 /** 236 /**
237 * Returns the number formatter for Q values in waterlevel exports. 237 * Returns the number formatter for Q values in waterlevel exports.
238 * 238 *
239 * @return the number formatter for Q values. 239 * @return the number formatter for Q values.
240 */ 240 */
241 public static NumberFormat getWaterlevelQ(CallContext context) { 241 public static NumberFormat getWaterlevelQ(final CallContext context) {
242 return getFormatter( 242 return getFormatter(
243 context, 243 context,
244 WATERLEVEL_Q_MIN_DIGITS, 244 WATERLEVEL_Q_MIN_DIGITS,
245 WATERLEVEL_Q_MAX_DIGITS); 245 WATERLEVEL_Q_MAX_DIGITS);
246 } 246 }
247 247
248 248
249 public static NumberFormat getWaterlevelQ(CallMeta meta) { 249 public static NumberFormat getWaterlevelQ(final CallMeta meta) {
250 return getFormatter( 250 return getFormatter(
251 meta, 251 meta,
252 WATERLEVEL_Q_MIN_DIGITS, 252 WATERLEVEL_Q_MIN_DIGITS,
253 WATERLEVEL_Q_MAX_DIGITS); 253 WATERLEVEL_Q_MAX_DIGITS);
254 } 254 }
257 * Returns the number formatter for W values in exports of computed 257 * Returns the number formatter for W values in exports of computed
258 * discharge curves. 258 * discharge curves.
259 * 259 *
260 * @return the number formatter for W values. 260 * @return the number formatter for W values.
261 */ 261 */
262 public static NumberFormat getComputedDischargeW(CallContext context) { 262 public static NumberFormat getComputedDischargeW(final CallContext context) {
263 return getFormatter( 263 return getFormatter(
264 context, 264 context,
265 COMPUTED_DISCHARGE_W_MIN_DIGITS, 265 COMPUTED_DISCHARGE_W_MIN_DIGITS,
266 COMPUTED_DISCHARGE_W_MAX_DIGITS); 266 COMPUTED_DISCHARGE_W_MAX_DIGITS);
267 } 267 }
271 * Returns the number formatter for Q values in exports of computed 271 * Returns the number formatter for Q values in exports of computed
272 * discharge curves. 272 * discharge curves.
273 * 273 *
274 * @return the number formatter for Q values. 274 * @return the number formatter for Q values.
275 */ 275 */
276 public static NumberFormat getComputedDischargeQ(CallContext context) { 276 public static NumberFormat getComputedDischargeQ(final CallContext context) {
277 return getFormatter( 277 return getFormatter(
278 context, 278 context,
279 COMPUTED_DISCHARGE_Q_MIN_DIGITS, 279 COMPUTED_DISCHARGE_Q_MIN_DIGITS,
280 COMPUTED_DISCHARGE_Q_MAX_DIGITS); 280 COMPUTED_DISCHARGE_Q_MAX_DIGITS);
281 } 281 }
285 * Returns the number formatter for W values in exports of historical 285 * Returns the number formatter for W values in exports of historical
286 * discharge curves. 286 * discharge curves.
287 * 287 *
288 * @return the number formatter for W values. 288 * @return the number formatter for W values.
289 */ 289 */
290 public static NumberFormat getHistoricalDischargeW(CallContext context) { 290 public static NumberFormat getHistoricalDischargeW(final CallContext context) {
291 return getFormatter( 291 return getFormatter(
292 context, 292 context,
293 HISTORICAL_DISCHARGE_W_MIN_DIGITS, 293 HISTORICAL_DISCHARGE_W_MIN_DIGITS,
294 HISTORICAL_DISCHARGE_W_MAX_DIGITS); 294 HISTORICAL_DISCHARGE_W_MAX_DIGITS);
295 } 295 }
299 * Returns the number formatter for Q values in exports of historical 299 * Returns the number formatter for Q values in exports of historical
300 * discharge curves. 300 * discharge curves.
301 * 301 *
302 * @return the number formatter for Q values. 302 * @return the number formatter for Q values.
303 */ 303 */
304 public static NumberFormat getHistoricalDischargeQ(CallContext context) { 304 public static NumberFormat getHistoricalDischargeQ(final CallContext context) {
305 return getFormatter( 305 return getFormatter(
306 context, 306 context,
307 HISTORICAL_DISCHARGE_Q_MIN_DIGITS, 307 HISTORICAL_DISCHARGE_Q_MIN_DIGITS,
308 HISTORICAL_DISCHARGE_Q_MAX_DIGITS); 308 HISTORICAL_DISCHARGE_Q_MAX_DIGITS);
309 } 309 }
312 /** 312 /**
313 * Returns the number formatter for W values in duration curve exports. 313 * Returns the number formatter for W values in duration curve exports.
314 * 314 *
315 * @return the number formatter for W values. 315 * @return the number formatter for W values.
316 */ 316 */
317 public static NumberFormat getDurationW(CallContext context) { 317 public static NumberFormat getDurationW(final CallContext context) {
318 return getFormatter( 318 return getFormatter(
319 context, 319 context,
320 DURATION_W_MIN_DIGITS, 320 DURATION_W_MIN_DIGITS,
321 DURATION_W_MAX_DIGITS); 321 DURATION_W_MAX_DIGITS);
322 } 322 }
325 /** 325 /**
326 * Returns the number formatter for Q values in duration curve exports. 326 * Returns the number formatter for Q values in duration curve exports.
327 * 327 *
328 * @return the number formatter for W values. 328 * @return the number formatter for W values.
329 */ 329 */
330 public static NumberFormat getDurationQ(CallContext context) { 330 public static NumberFormat getDurationQ(final CallContext context) {
331 return getFormatter( 331 return getFormatter(
332 context, 332 context,
333 DURATION_Q_MIN_DIGITS, 333 DURATION_Q_MIN_DIGITS,
334 DURATION_Q_MAX_DIGITS); 334 DURATION_Q_MAX_DIGITS);
335 } 335 }
338 /** 338 /**
339 * Returns the number formatter for D values in duration curve exports. 339 * Returns the number formatter for D values in duration curve exports.
340 * 340 *
341 * @return the number formatter for W values. 341 * @return the number formatter for W values.
342 */ 342 */
343 public static NumberFormat getDurationD(CallContext context) { 343 public static NumberFormat getDurationD(final CallContext context) {
344 return getFormatter( 344 return getFormatter(
345 context, 345 context,
346 DURATION_D_MIN_DIGITS, 346 DURATION_D_MIN_DIGITS,
347 DURATION_D_MAX_DIGITS); 347 DURATION_D_MAX_DIGITS);
348 } 348 }
349 349
350 public static NumberFormat getCalculationKm(CallMeta meta) { 350 public static NumberFormat getCalculationKm(final CallMeta meta) {
351 return getFormatter( 351 return getFormatter(
352 meta, 352 meta,
353 CALCULATION_REPORT_KM_MIN_DIGITS, 353 CALCULATION_REPORT_KM_MIN_DIGITS,
354 CALCULATION_REPORT_KM_MAX_DIGITS); 354 CALCULATION_REPORT_KM_MAX_DIGITS);
355 } 355 }
356 356
357 357
358 public static NumberFormat getFlowVelocityKM(CallContext context) { 358 public static NumberFormat getFlowVelocityKM(final CallContext context) {
359 return getFormatter( 359 return getFormatter(
360 context, 360 context,
361 FLOW_VELOCITY_KM_MIN_DIGITS, 361 FLOW_VELOCITY_KM_MIN_DIGITS,
362 FLOW_VELOCITY_KM_MAX_DIGITS); 362 FLOW_VELOCITY_KM_MAX_DIGITS);
363 } 363 }
364 364
365 365
366 public static NumberFormat getFlowVelocityValues(CallContext context) { 366 public static NumberFormat getFlowVelocityValues(final CallContext context) {
367 return getFormatter( 367 return getFormatter(
368 context, 368 context,
369 FLOW_VELOCITY_VALUES_MIN_DIGITS, 369 FLOW_VELOCITY_VALUES_MIN_DIGITS,
370 FLOW_VELOCITY_VALUES_MAX_DIGITS); 370 FLOW_VELOCITY_VALUES_MAX_DIGITS);
371 } 371 }
372 372
373 373
374 public static NumberFormat getFlowVelocityQ(CallContext context) { 374 public static NumberFormat getFlowVelocityQ(final CallContext context) {
375 return getFormatter( 375 return getFormatter(
376 context, 376 context,
377 FLOW_VELOCITY_Q_MIN_DIGITS, 377 FLOW_VELOCITY_Q_MIN_DIGITS,
378 FLOW_VELOCITY_Q_MAX_DIGITS); 378 FLOW_VELOCITY_Q_MAX_DIGITS);
379 } 379 }
380 380
381 381
382 public static NumberFormat getMiddleBedHeightKM(CallContext context) { 382 public static NumberFormat getMiddleBedHeightKM(final CallContext context) {
383 return getFormatter( 383 return getFormatter(
384 context, 384 context,
385 MIDDLE_BED_HEIGHT_KM_MIN_DIGITS, 385 MIDDLE_BED_HEIGHT_KM_MIN_DIGITS,
386 MIDDLE_BED_HEIGHT_KM_MAX_DIGITS); 386 MIDDLE_BED_HEIGHT_KM_MAX_DIGITS);
387 } 387 }
388 388
389 389
390 public static NumberFormat getMiddleBedHeightHeight(CallContext context) { 390 public static NumberFormat getMiddleBedHeightHeight(final CallContext context) {
391 return getFormatter( 391 return getFormatter(
392 context, 392 context,
393 MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS, 393 MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS,
394 MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS); 394 MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS);
395 } 395 }
396 396
397 397
398 public static NumberFormat getMiddleBedHeightUncert(CallContext context) { 398 public static NumberFormat getMiddleBedHeightUncert(final CallContext context) {
399 return getFormatter( 399 return getFormatter(
400 context, 400 context,
401 MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS, 401 MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS,
402 MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS); 402 MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS);
403 } 403 }
404 404
405 405
406 public static NumberFormat getMiddleBedHeightDataGap(CallContext context) { 406 public static NumberFormat getMiddleBedHeightDataGap(final CallContext context) {
407 return getFormatter( 407 return getFormatter(
408 context, 408 context,
409 MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS, 409 MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS,
410 MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS); 410 MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS);
411 } 411 }
412 412
413 413
414 public static NumberFormat getMiddleBedHeightSounding( 414 public static NumberFormat getMiddleBedHeightSounding(
415 CallContext context 415 final CallContext context
416 ) { 416 ) {
417 return getFormatter( 417 return getFormatter(
418 context, 418 context,
419 MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS, 419 MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS,
420 MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS); 420 MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS);
421 } 421 }
422 422
423 423
424 public static NumberFormat getFixDeltaWKM(CallContext context) { 424 public static NumberFormat getFixDeltaWKM(final CallContext context) {
425 return getFormatter( 425 return getFormatter(
426 context, 426 context,
427 FIX_DELTA_W_KM_MIN_DIGITS, 427 FIX_DELTA_W_KM_MIN_DIGITS,
428 FIX_DELTA_W_KM_MAX_DIGITS); 428 FIX_DELTA_W_KM_MAX_DIGITS);
429 } 429 }
430 430
431 public static NumberFormat getFixDeltaWDeltaW(CallContext context) { 431 public static NumberFormat getFixDeltaWDeltaW(final CallContext context) {
432 return getFormatter( 432 return getFormatter(
433 context, 433 context,
434 FIX_DELTA_W_DELTA_W_MIN_DIGITS, 434 FIX_DELTA_W_DELTA_W_MIN_DIGITS,
435 FIX_DELTA_W_DELTA_W_MAX_DIGITS); 435 FIX_DELTA_W_DELTA_W_MAX_DIGITS);
436 } 436 }
437 437
438 public static NumberFormat getFixDeltaWQ(CallContext context) { 438 public static NumberFormat getFixDeltaWQ(final CallContext context) {
439 return getFormatter( 439 return getFormatter(
440 context, 440 context,
441 FIX_DELTA_W_DELTA_Q_MIN_DIGITS, 441 FIX_DELTA_W_DELTA_Q_MIN_DIGITS,
442 FIX_DELTA_W_DELTA_Q_MAX_DIGITS); 442 FIX_DELTA_W_DELTA_Q_MAX_DIGITS);
443 } 443 }
444 444
445 public static NumberFormat getFixDeltaWW(CallContext context) { 445 public static NumberFormat getFixDeltaWW(final CallContext context) {
446 return getFormatter( 446 return getFormatter(
447 context, 447 context,
448 FIX_DELTA_W_DELTA_W_MIN_DIGITS, 448 FIX_DELTA_W_DELTA_W_MIN_DIGITS,
449 FIX_DELTA_W_DELTA_W_MAX_DIGITS); 449 FIX_DELTA_W_DELTA_W_MAX_DIGITS);
450 } 450 }
451 451
452 public static NumberFormat getVariance(CallContext context) { 452 public static NumberFormat getVariance(final CallContext context) {
453 return getFormatter( 453 return getFormatter(
454 context, 454 context,
455 VARIANCE_MIN_DIGITS, 455 VARIANCE_MIN_DIGITS,
456 VARIANCE_MAX_DIGITS); 456 VARIANCE_MAX_DIGITS);
457 } 457 }
458 458
459 public static NumberFormat getSQRelationA(CallContext context) { 459 public static NumberFormat getSQRelationA(final CallContext context) {
460 return getScientificFormater( 460 return getScientificFormater(
461 context, 461 context,
462 SQ_RELATION_A_MIN_DIGITS, 462 SQ_RELATION_A_MIN_DIGITS,
463 SQ_RELATION_A_MAX_DIGITS); 463 SQ_RELATION_A_MAX_DIGITS);
464 } 464 }
465 465
466 public static NumberFormat getSQRelationB(CallContext context) { 466 public static NumberFormat getSQRelationB(final CallContext context) {
467 return getFormatter( 467 return getFormatter(
468 context, 468 context,
469 SQ_RELATION_B_MIN_DIGITS, 469 SQ_RELATION_B_MIN_DIGITS,
470 SQ_RELATION_B_MAX_DIGITS); 470 SQ_RELATION_B_MAX_DIGITS);
471 } 471 }
472 472
473 public static NumberFormat getSQRelationKM(CallContext context) { 473 public static NumberFormat getSQRelationKM(final CallContext context) {
474 return getFormatter( 474 return getFormatter(
475 context, 475 context,
476 SQ_RELATION_KM_MIN_DIGITS, 476 SQ_RELATION_KM_MIN_DIGITS,
477 SQ_RELATION_KM_MAX_DIGITS); 477 SQ_RELATION_KM_MAX_DIGITS);
478 } 478 }
479 479
480 public static NumberFormat getMeterFormat(CallContext context) { 480 public static NumberFormat getMeterFormat(final CallContext context) {
481 return getFormatter( 481 return getFormatter(
482 context, 482 context,
483 0, 483 0,
484 2); 484 2);
485 485
486 } 486 }
487 487
488 public static DateFormat getDateFormatter(CallMeta m, String pattern) { 488 public static DateFormat getDateFormatter(final CallMeta m, final String pattern) {
489 Locale locale = Resources.getLocale(m); 489 final Locale locale = Resources.getLocale(m);
490 return new SimpleDateFormat(pattern, locale); 490 return new SimpleDateFormat(pattern, locale);
491 } 491 }
492 492
493 public static NumberFormat getMeanBedHeight(CallContext context) { 493 public static NumberFormat getMeanBedHeight(final CallContext context) {
494 return Formatter.getFormatter(context, 2, 2); 494 return Formatter.getFormatter(context, 2, 2);
495 } 495 }
496 496
497 public static NumberFormat getTkh(CallContext context) { 497 public static NumberFormat getTkh(final CallContext context) {
498 return Formatter.getFormatter(context, 1, 1); 498 return Formatter.getFormatter(context, 1, 1);
499 } 499 }
500 500
501 public static NumberFormat getFlowDepth(CallContext context) { 501 public static NumberFormat getFlowDepth(final CallContext context) {
502 return Formatter.getFormatter(context, 2, 2); 502 return Formatter.getFormatter(context, 2, 2);
503 } 503 }
504 504
505 public static NumberFormat getW(CallContext context) { 505 public static NumberFormat getW(final CallContext context) {
506 return Formatter.getFormatter(context, 2, 2); 506 return Formatter.getFormatter(context, 2, 2);
507 } 507 }
508 508
509 /** 509 /**
510 * Another waterlevel formatter with fixed digits (always 2) 510 * Another waterlevel formatter with fixed digits (always 2)
511 */ 511 */
512 public static NumberFormat getWaterlevelW2(CallMeta meta) { 512 public static NumberFormat getWaterlevelW2(final CallMeta meta) {
513 return getFormatter( meta, 2, 2); 513 return getFormatter( meta, 2, 2);
514 } 514 }
515
516 public static NumberFormat getFlowDepthDevelopmentPerYear(final CallContext context) {
517 return getFormatter(context.getMeta(), 2, 2);
518 }
515 } 519 }
516 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org