Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java @ 5639:db4e7ff0b987
Doc and whitespaces.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 10 Apr 2013 09:27:18 +0200 |
parents | 04309ca24614 |
children |
comparison
equal
deleted
inserted
replaced
5638:0ebadc678fbc | 5639:db4e7ff0b987 |
---|---|
8 import de.intevation.artifacts.CallContext; | 8 import de.intevation.artifacts.CallContext; |
9 import de.intevation.artifacts.CallMeta; | 9 import de.intevation.artifacts.CallMeta; |
10 import de.intevation.flys.artifacts.resources.Resources; | 10 import de.intevation.flys.artifacts.resources.Resources; |
11 | 11 |
12 | 12 |
13 /** Helper to access static i18n Formatters. */ | |
13 public final class Formatter { | 14 public final class Formatter { |
14 | 15 |
15 // KMS IN ERROR REPORTS. | 16 // KMS IN ERROR REPORTS. |
16 public static final int CALCULATION_REPORT_KM_MIN_DIGITS = 1; | 17 public static final int CALCULATION_REPORT_KM_MIN_DIGITS = 1; |
17 public static final int CALCULATION_REPORT_KM_MAX_DIGITS = 3; | 18 public static final int CALCULATION_REPORT_KM_MAX_DIGITS = 3; |
76 public static final int FIX_DELTA_W_DELTA_W_MIN_DIGITS = 3; | 77 public static final int FIX_DELTA_W_DELTA_W_MIN_DIGITS = 3; |
77 public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3; | 78 public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3; |
78 public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS = 0; | 79 public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS = 0; |
79 public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS = 2; | 80 public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS = 2; |
80 | 81 |
82 | |
81 /** | 83 /** |
82 * Creates a localized NumberFormatter with given range of decimal digits. | 84 * Creates a localized NumberFormatter with given range of decimal digits. |
83 * @param m CallMeta to find the locale. | 85 * @param m CallMeta to find the locale. |
84 * @param min minimum number of decimal ("fraction") digits. | 86 * @param min minimum number of decimal ("fraction") digits. |
85 * @param max maximum number of decimal ("fraction") digits. | 87 * @param max maximum number of decimal ("fraction") digits. |
94 nf.setMinimumFractionDigits(min); | 96 nf.setMinimumFractionDigits(min); |
95 | 97 |
96 return nf; | 98 return nf; |
97 } | 99 } |
98 | 100 |
101 | |
99 public static NumberFormat getFormatter(CallContext c, int min, int max){ | 102 public static NumberFormat getFormatter(CallContext c, int min, int max){ |
100 return getFormatter(c.getMeta(), min, max); | 103 return getFormatter(c.getMeta(), min, max); |
101 } | 104 } |
102 | 105 |
103 | 106 |
142 context, | 145 context, |
143 WATERLEVEL_KM_MIN_DIGITS, | 146 WATERLEVEL_KM_MIN_DIGITS, |
144 WATERLEVEL_KM_MAX_DIGITS); | 147 WATERLEVEL_KM_MAX_DIGITS); |
145 } | 148 } |
146 | 149 |
150 | |
147 public static NumberFormat getWaterlevelW(CallMeta meta) { | 151 public static NumberFormat getWaterlevelW(CallMeta meta) { |
148 return getFormatter( | 152 return getFormatter( |
149 meta, | 153 meta, |
150 WATERLEVEL_W_MIN_DIGITS, | 154 WATERLEVEL_W_MIN_DIGITS, |
151 WATERLEVEL_W_MAX_DIGITS); | 155 WATERLEVEL_W_MAX_DIGITS); |
152 } | 156 } |
153 | 157 |
158 | |
154 /** | 159 /** |
155 * Returns the number formatter for W values in waterlevel exports. | 160 * Returns the number formatter for W values in waterlevel exports. |
156 * | 161 * |
157 * @return the number formatter for W values. | 162 * @return the number formatter for W values. |
158 */ | 163 */ |
173 return getFormatter( | 178 return getFormatter( |
174 context, | 179 context, |
175 WATERLEVEL_Q_MIN_DIGITS, | 180 WATERLEVEL_Q_MIN_DIGITS, |
176 WATERLEVEL_Q_MAX_DIGITS); | 181 WATERLEVEL_Q_MAX_DIGITS); |
177 } | 182 } |
183 | |
178 | 184 |
179 public static NumberFormat getWaterlevelQ(CallMeta meta) { | 185 public static NumberFormat getWaterlevelQ(CallMeta meta) { |
180 return getFormatter( | 186 return getFormatter( |
181 meta, | 187 meta, |
182 WATERLEVEL_Q_MIN_DIGITS, | 188 WATERLEVEL_Q_MIN_DIGITS, |