[PATCH 2 of 4] (issue1754) Extend RangeAccess to simplyfiy range access where it is assumed that from < to
Wald Commits
scm-commit at wald.intevation.org
Mon Mar 30 19:29:38 CEST 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427736431 -7200
# Node ID 8e5c026216fd7eaef87883b92816e2485ecd0123
# Parent 5c4766ac20ba7cf743a1da9b8e75098758126503
(issue1754) Extend RangeAccess to simplyfiy range access where it is assumed that from < to
diff -r 5c4766ac20ba -r 8e5c026216fd artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java Mon Mar 30 19:11:35 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java Mon Mar 30 19:27:11 2015 +0200
@@ -125,6 +125,16 @@
return to != null || (to = getDouble("ld_to")) != null;
}
+ /* If left_to_right is set to true this returns
+ * the smaller value of from and to. */
+ public double getFrom(boolean left_to_right) {
+ if (!left_to_right) {
+ return getFrom();
+ }
+ double from = getFrom();
+ double to = getTo();
+ return from > to ? to : from;
+ }
/** Return ld_from data (in km). If not found, the min. */
public double getFrom() {
@@ -144,6 +154,16 @@
return from.doubleValue();
}
+ /* If left_to_right is set to true this returns
+ * the larger value of from and to. */
+ public double getTo(boolean left_to_right) {
+ if (!left_to_right) {
+ return getTo();
+ }
+ double from = getFrom();
+ double to = getTo();
+ return from > to ? from : to;
+ }
/** Return ld_to data (in km), if not found, the max. */
public double getTo() {
More information about the Dive4Elements-commits
mailing list