diff --git a/jpx/src/main/java/io/jenetics/jpx/format/Field.java b/jpx/src/main/java/io/jenetics/jpx/format/Field.java index 31eb558b..f13e258e 100644 --- a/jpx/src/main/java/io/jenetics/jpx/format/Field.java +++ b/jpx/src/main/java/io/jenetics/jpx/format/Field.java @@ -17,6 +17,8 @@ import static java.lang.Math.abs; import static java.lang.Math.floor; +import static java.math.RoundingMode.DOWN; +import static java.math.RoundingMode.HALF_EVEN; import static java.util.Objects.requireNonNull; import java.math.RoundingMode; @@ -60,12 +62,12 @@ abstract class Field implements Format { void setPrefixSign(final boolean b) { } - void setFormat(final NumberFormat format) { - _format.set(requireNonNull(format)); + void setTruncate(final boolean b) { + _format.get().setRoundingMode(b ? DOWN : HALF_EVEN); } - void setRoundingMode(final RoundingMode mode) { - _format.get().setRoundingMode(mode); + void setFormat(final NumberFormat format) { + _format.set(requireNonNull(format)); } int getMinimumFractionDigits() { diff --git a/jpx/src/main/java/io/jenetics/jpx/format/LatitudeDegree.java b/jpx/src/main/java/io/jenetics/jpx/format/LatitudeDegree.java index 4c7a75c4..2467a90c 100644 --- a/jpx/src/main/java/io/jenetics/jpx/format/LatitudeDegree.java +++ b/jpx/src/main/java/io/jenetics/jpx/format/LatitudeDegree.java @@ -16,8 +16,6 @@ package io.jenetics.jpx.format; import static java.lang.Math.abs; -import static java.math.RoundingMode.DOWN; -import static java.math.RoundingMode.HALF_EVEN; import java.text.DecimalFormat; import java.text.ParsePosition; @@ -54,10 +52,6 @@ boolean isPrefixSign() { return _prefixSign; } - void setTruncate(final boolean b) { - setRoundingMode(b ? DOWN : HALF_EVEN); - } - private boolean absolute = false; void setAbsolute(final boolean b) { diff --git a/jpx/src/main/java/io/jenetics/jpx/format/LatitudeMinute.java b/jpx/src/main/java/io/jenetics/jpx/format/LatitudeMinute.java index 3ed72222..4e53e3b5 100644 --- a/jpx/src/main/java/io/jenetics/jpx/format/LatitudeMinute.java +++ b/jpx/src/main/java/io/jenetics/jpx/format/LatitudeMinute.java @@ -15,9 +15,6 @@ */ package io.jenetics.jpx.format; -import static java.math.RoundingMode.DOWN; -import static java.math.RoundingMode.HALF_EVEN; - import java.text.ParsePosition; import java.util.Optional; @@ -41,10 +38,6 @@ char type() { return 'M'; } - void setTruncate(final boolean b) { - setRoundingMode(b ? DOWN : HALF_EVEN); - } - @Override public void parse( final CharSequence in, diff --git a/jpx/src/main/java/io/jenetics/jpx/format/LongitudeDegree.java b/jpx/src/main/java/io/jenetics/jpx/format/LongitudeDegree.java index 269d9fba..a36fc6d3 100644 --- a/jpx/src/main/java/io/jenetics/jpx/format/LongitudeDegree.java +++ b/jpx/src/main/java/io/jenetics/jpx/format/LongitudeDegree.java @@ -16,8 +16,6 @@ package io.jenetics.jpx.format; import static java.lang.Math.abs; -import static java.math.RoundingMode.DOWN; -import static java.math.RoundingMode.HALF_EVEN; import java.text.DecimalFormat; import java.text.ParsePosition; @@ -58,10 +56,6 @@ boolean isPrefixSign() { return prefixSign; } - void setTruncate(final boolean b) { - setRoundingMode(b ? DOWN : HALF_EVEN); - } - void setAbsolute(final boolean b) { absolute = b; } diff --git a/jpx/src/main/java/io/jenetics/jpx/format/LongitudeMinute.java b/jpx/src/main/java/io/jenetics/jpx/format/LongitudeMinute.java index 7985bac1..a08c6bac 100644 --- a/jpx/src/main/java/io/jenetics/jpx/format/LongitudeMinute.java +++ b/jpx/src/main/java/io/jenetics/jpx/format/LongitudeMinute.java @@ -15,9 +15,6 @@ */ package io.jenetics.jpx.format; -import static java.math.RoundingMode.DOWN; -import static java.math.RoundingMode.HALF_EVEN; - import java.text.ParsePosition; import java.util.Optional; @@ -41,10 +38,6 @@ char type() { return 'm'; } - void setTruncate(final boolean b) { - setRoundingMode(b ? DOWN : HALF_EVEN); - } - @Override public void parse( final CharSequence in,