comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 707:b6f57d927905

Removed more dead code. flys-artifacts/trunk@2159 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 18 Jun 2011 18:38:04 +0000
parents ddd8b37d5cd3
children 757ff56b43b3
comparison
equal deleted inserted replaced
706:ddd8b37d5cd3 707:b6f57d927905
37 import de.intevation.artifactdatabase.transition.TransitionEngine; 37 import de.intevation.artifactdatabase.transition.TransitionEngine;
38 38
39 import de.intevation.flys.utils.DoubleUtil; 39 import de.intevation.flys.utils.DoubleUtil;
40 40
41 import de.intevation.flys.model.Gauge; 41 import de.intevation.flys.model.Gauge;
42 import de.intevation.flys.model.Range;
43 import de.intevation.flys.model.River; 42 import de.intevation.flys.model.River;
44 43
45 import de.intevation.flys.artifacts.context.FLYSContext; 44 import de.intevation.flys.artifacts.context.FLYSContext;
46 45
47 import de.intevation.flys.artifacts.cache.CacheFactory; 46 import de.intevation.flys.artifacts.cache.CacheFactory;
524 return value.equals("distance"); 523 return value.equals("distance");
525 } 524 }
526 525
527 526
528 /** 527 /**
529 * This method returns the given distance
530 *
531 * @return an array with lower and upper kilometer range for each
532 * intersected gauge.
533 */
534 public double[][] getSplittedDistance() {
535 double[] dist = getDistance();
536 List<Gauge> gauges = getGauges();
537
538 int num = gauges != null ? gauges.size() : 0;
539
540 double[][] res = new double[num][2];
541
542 for (int i = 0; i < num; i++) {
543 Range range = gauges.get(i).getRange();
544
545 double lower = range.getA().doubleValue();
546 double upper = range.getB().doubleValue();
547
548 res[i][0] = dist[0] < lower ? lower : dist[0];
549 res[i][1] = dist[1] > upper ? upper : dist[1];
550 }
551
552 return res;
553 }
554
555
556 /**
557 * Returns the selected locations based on a given array of locations. 528 * Returns the selected locations based on a given array of locations.
558 * 529 *
559 * @param locations The StateData that contains the locations. 530 * @param locations The StateData that contains the locations.
560 * 531 *
561 * @return the selected locations. 532 * @return the selected locations.
627 598
628 if (step == 0d) { 599 if (step == 0d) {
629 step = DEFAULT_KM_STEPS; 600 step = DEFAULT_KM_STEPS;
630 } 601 }
631 602
632 return getExplodedValues(distance[0], distance[1], step); 603 return DoubleUtil.explode(distance[0], distance[1], step);
633 } 604 }
634 605
635 606
636 /** 607 /**
637 * Returns the selected Kms. 608 * Returns the selected Kms.
1008 if (step == 0d) { 979 if (step == 0d) {
1009 double diff = to - from; 980 double diff = to - from;
1010 step = diff / DEFAULT_Q_STEPS; 981 step = diff / DEFAULT_Q_STEPS;
1011 } 982 }
1012 983
1013 return getExplodedValues(from, to, step); 984 return DoubleUtil.explode(from, to, step);
1014 } 985 }
1015 986
1016 987
1017 /** 988 /**
1018 * Returns an array of inserted WQ double values stored as whitespace 989 * Returns an array of inserted WQ double values stored as whitespace
1045 values.sort(); 1016 values.sort();
1046 1017
1047 return values.toNativeArray(); 1018 return values.toNativeArray();
1048 } 1019 }
1049 1020
1050
1051 /**
1052 * Returns an array of double values. The values contained in this array
1053 * begin with the value <i>from</i> and end with the value <i>to</i>. The
1054 * number of values in the result array depends on the <i>step</i> width.
1055 *
1056 * @param from The lower value.
1057 * @param to The upper value.
1058 * @param step The step width between two values in the result array.
1059 *
1060 * @return an array of double values.
1061 */
1062 public static double[] getExplodedValues(
1063 double from,
1064 double to,
1065 double step
1066 ) {
1067 return DoubleUtil.explode(from, to, step);
1068 }
1069 1021
1070 /** 1022 /**
1071 * Computes the hash code of the entered values. 1023 * Computes the hash code of the entered values.
1072 * 1024 *
1073 * @return a hash code. 1025 * @return a hash code.

http://dive4elements.wald.intevation.org