[PATCH] Remove further indirection in WINFOArtifact
Wald Commits
scm-commit at wald.intevation.org
Fri Jun 26 14:31:30 CEST 2015
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1435321868 -7200
# Node ID bd17bd07db69b93050acf0cb64fdd14674878158
# Parent 26dedebbe39f0ecdd16c7b3bd29042465111ec7f
Remove further indirection in WINFOArtifact.
diff -r 26dedebbe39f -r bd17bd07db69 artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java Wed Jun 24 15:49:23 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java Fri Jun 26 14:31:08 2015 +0200
@@ -782,19 +782,6 @@
/**
- * Determines the selected mode of distance/range input.
- *
- * Compatibility wrapper around RangeAccess.
- *
- * @return true, if the range mode is selected otherwise false.
- */
- public boolean isRange() {
- RangeAccess rangeAccess = new RangeAccess(this);
- return rangeAccess.isRange();
- }
-
-
- /**
* Returns the selected distance based on a given range (from, to).
*
* @param dFrom The StateData that contains the lower value.
@@ -816,8 +803,8 @@
* @return the selected kms.
*/
public double[] getKms() {
- if (isRange()) {
- RangeAccess rangeAccess = new RangeAccess(this);
+ RangeAccess rangeAccess = new RangeAccess(this);
+ if (rangeAccess.isRange()) {
return rangeAccess.getKmSteps();
}
else {
@@ -827,10 +814,10 @@
public double [] getFromToStep() {
- if (!isRange()) {
+ RangeAccess rangeAccess = new RangeAccess(this);
+ if (!rangeAccess.isRange()) {
return null;
}
- RangeAccess rangeAccess = new RangeAccess(this);
double [] fromTo = rangeAccess.getKmRange();
if (fromTo == null) {
diff -r 26dedebbe39f -r bd17bd07db69 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java Wed Jun 24 15:49:23 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQSelect.java Fri Jun 26 14:31:08 2015 +0200
@@ -32,6 +32,8 @@
import org.dive4elements.river.artifacts.D4EArtifact;
import org.dive4elements.river.artifacts.WINFOArtifact;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+
import org.dive4elements.river.artifacts.model.WstFactory;
import org.dive4elements.river.artifacts.model.WstValueTable;
import org.dive4elements.river.artifacts.model.WstValueTableFactory;
@@ -430,7 +432,7 @@
double[] minmaxW = null;
if(valueTable != null) {
double[] km = null;
- if(winfo.isRange()) {
+ if(new RangeAccess(winfo).isRange()) {
km = winfo.getFromToStep();
// Use the start km to determine the min max values.
minmaxW = valueTable.getMinMaxW(km[0]);
@@ -493,7 +495,7 @@
double[] minmaxQ = null;
if(valueTable != null) {
double[] km = null;
- if(winfo.isRange()) {
+ if(new RangeAccess(winfo).isRange()) {
km = winfo.getFromToStep();
minmaxQ = valueTable.getMinMaxQ(km[0], km[1], km[2]);
}
More information about the Dive4Elements-commits
mailing list