comparison flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java @ 2702:4c00cf83fff1

Added state, calculation and csv exporter for MINFO flow velociy calculation. flys-artifacts/trunk@4418 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 16 May 2012 08:37:27 +0000
parents 7dd45896e941
children 2952f6dee5cf
comparison
equal deleted inserted replaced
2701:c553d4fa3957 2702:4c00cf83fff1
46 public static final int DURATION_Q_MAX_DIGITS = 1; 46 public static final int DURATION_Q_MAX_DIGITS = 1;
47 public static final int DURATION_D_MIN_DIGITS = 0; 47 public static final int DURATION_D_MIN_DIGITS = 0;
48 public static final int DURATION_D_MAX_DIGITS = 0; 48 public static final int DURATION_D_MAX_DIGITS = 0;
49 49
50 50
51 // FLOW VELOCITY FORMATTER CONSTANTS
52 public static final int FLOW_VELOCITY_KM_MIN_DIGITS = 3;
53 public static final int FLOW_VELOCITY_KM_MAX_DIGITS = 3;
54 public static final int FLOW_VELOCITY_VALUES_MIN_DIGITS = 2;
55 public static final int FLOW_VELOCITY_VALUES_MAX_DIGITS = 2;
56 public static final int FLOW_VELOCITY_Q_MIN_DIGITS = 0;
57 public static final int FLOW_VELOCITY_Q_MAX_DIGITS = 2;
58
59
51 public static NumberFormat getFormatter(CallMeta m, int min, int max){ 60 public static NumberFormat getFormatter(CallMeta m, int min, int max){
52 Locale locale = Resources.getLocale(m); 61 Locale locale = Resources.getLocale(m);
53 NumberFormat nf = NumberFormat.getInstance(locale); 62 NumberFormat nf = NumberFormat.getInstance(locale);
54 63
55 nf.setMaximumFractionDigits(max); 64 nf.setMaximumFractionDigits(max);
231 return getFormatter( 240 return getFormatter(
232 meta, 241 meta,
233 CALCULATION_REPORT_KM_MIN_DIGITS, 242 CALCULATION_REPORT_KM_MIN_DIGITS,
234 CALCULATION_REPORT_KM_MAX_DIGITS); 243 CALCULATION_REPORT_KM_MAX_DIGITS);
235 } 244 }
245
246
247 public static NumberFormat getFlowVelocityKM(CallContext context) {
248 return getFormatter(
249 context,
250 FLOW_VELOCITY_KM_MIN_DIGITS,
251 FLOW_VELOCITY_KM_MAX_DIGITS);
252 }
253
254
255 public static NumberFormat getFlowVelocityValues(CallContext context) {
256 return getFormatter(
257 context,
258 FLOW_VELOCITY_VALUES_MIN_DIGITS,
259 FLOW_VELOCITY_VALUES_MAX_DIGITS);
260 }
261
262
263 public static NumberFormat getFlowVelocityQ(CallContext context) {
264 return getFormatter(
265 context,
266 FLOW_VELOCITY_Q_MIN_DIGITS,
267 FLOW_VELOCITY_Q_MAX_DIGITS);
268 }
236 } 269 }
237 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 270 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org