Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java @ 2560:0d8c97374dc9
WstValueTable: Forget to check in the range method of getMinMaxQ().
flys-artifacts/trunk@4086 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 14:16:50 +0000 |
parents | 407bbc74fe0b |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2559:407bbc74fe0b | 2560:0d8c97374dc9 |
---|---|
630 } | 630 } |
631 | 631 |
632 return null; | 632 return null; |
633 } | 633 } |
634 | 634 |
635 public double [] getMinMaxQ(double from, double to, double step) { | |
636 double [] result = new double[2]; | |
637 | |
638 double minQ = Double.MAX_VALUE; | |
639 double maxQ = -Double.MAX_VALUE; | |
640 | |
641 if (from > to) { | |
642 double tmp = from; | |
643 from = to; | |
644 to = tmp; | |
645 } | |
646 | |
647 step = Math.max(Math.abs(step), 0.0001); | |
648 | |
649 double d = from; | |
650 for (; d <= to; d += step) { | |
651 if (getMinMaxQ(d, result) != null) { | |
652 if (result[0] < minQ) minQ = result[0]; | |
653 if (result[1] > maxQ) maxQ = result[1]; | |
654 } | |
655 } | |
656 | |
657 if (d != to) { | |
658 if (getMinMaxQ(to, result) != null) { | |
659 if (result[0] < minQ) minQ = result[0]; | |
660 if (result[1] > maxQ) maxQ = result[1]; | |
661 } | |
662 } | |
663 | |
664 return minQ < Double.MAX_VALUE | |
665 ? new double [] { minQ, maxQ } | |
666 : null; | |
667 } | |
635 | 668 |
636 public double [] getMinMaxW(double km) { | 669 public double [] getMinMaxW(double km) { |
637 return getMinMaxW(km, new double [2]); | 670 return getMinMaxW(km, new double [2]); |
638 | 671 |
639 } | 672 } |