[Dive4elements-commits] [PATCH] Add SQ Relation KM formatter and use it fopr issue 1071
Wald Commits
scm-commit at wald.intevation.org
Thu Jun 13 09:24:24 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1371108166 -7200
# Node ID 8c976bb0362fe5ac408407f91c0de7b40052065a
# Parent 6c41a4ca2876509eb789c2e36ee30998eccefcdf
Add SQ Relation KM formatter and use it fopr issue 1071
diff -r 6c41a4ca2876 -r 8c976bb0362f artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java Thu Jun 13 09:09:56 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java Thu Jun 13 09:22:46 2013 +0200
@@ -156,7 +156,8 @@
}
protected List<String[]> data2StringArrays(SQResult result) {
- String km = String.valueOf(result.getKm());
+ String km = Formatter.getSQRelationKM(context
+ ).format(result.getKm());
List<String[]> retval = new ArrayList<String[]>();
for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) {
diff -r 6c41a4ca2876 -r 8c976bb0362f artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Thu Jun 13 09:09:56 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Thu Jun 13 09:22:46 2013 +0200
@@ -92,10 +92,12 @@
public static final int VARIANCE_MAX_DIGITS = 3;
// SQ Relation
- public static final int SQ_RELATION_A_MAX_DIGITS = 7;
- public static final int SQ_RELATION_A_MIN_DIGITS = 7;
- public static final int SQ_RELATION_B_MAX_DIGITS = 3;
- public static final int SQ_RELATION_B_MIN_DIGITS = 3;
+ public static final int SQ_RELATION_KM_MIN_DIGITS = 2;
+ public static final int SQ_RELATION_KM_MAX_DIGITS = 2;
+ public static final int SQ_RELATION_A_MAX_DIGITS = 7;
+ public static final int SQ_RELATION_A_MIN_DIGITS = 7;
+ public static final int SQ_RELATION_B_MAX_DIGITS = 3;
+ public static final int SQ_RELATION_B_MIN_DIGITS = 3;
/**
* Creates a localized NumberFormatter with given range of decimal digits.
@@ -453,6 +455,13 @@
SQ_RELATION_B_MAX_DIGITS);
}
+ public static NumberFormat getSQRelationKM(CallContext context) {
+ return getFormatter(
+ context,
+ SQ_RELATION_KM_MIN_DIGITS,
+ SQ_RELATION_KM_MAX_DIGITS);
+ }
+
public static NumberFormat getMeterFormat(CallContext context) {
return getFormatter(
context,
More information about the Dive4elements-commits
mailing list