Mercurial > dive4elements > river
changeset 2372:027736510a30
Added a new method Wst.determineMinMaxQ(double,double).
flys-backend/trunk@3552 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 28 Dec 2011 12:16:52 +0000 |
parents | fe89d6cf55fb |
children | 056b3a5aa181 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/Wst.java |
diffstat | 2 files changed, 29 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Mon Dec 19 11:21:25 2011 +0000 +++ b/flys-backend/ChangeLog Wed Dec 28 12:16:52 2011 +0000 @@ -1,3 +1,9 @@ +2011-12-28 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/model/Wst.java: Added a method + determineMinMaxQ(double double) to be able to determine the Q range of a + WST without having a Range object. + 2011-12-19 Sascha L. Teichmann <sascha.teichmann@intevation.de>: * src/main/java/de/intevation/flys/importer/parsers/StaFileParser.java:
--- a/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Mon Dec 19 11:21:25 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Wed Dec 28 12:16:52 2011 +0000 @@ -129,6 +129,27 @@ * @return the min and max Q values of this WST. */ public double[] determineMinMaxQ(Range range) { + if (range != null) { + return determineMinMaxQ( + range.getA().doubleValue(), + range.getB().doubleValue()); + } + + return null; + } + + + /** + * Determines the min and max Q values of this WST in the given range. The + * min value is placed in the first field of the resulting array - the max + * value is placed in the second field. + * + * @param fromKm the lower km value. + * @param toKm the upper km value. + * + * @return the min and max Q values of this WST. + */ + public double[] determineMinMaxQ(double fromKm, double toKm) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( @@ -140,8 +161,8 @@ " (select id from Range where not (a > :end or b < :start))"); query.setParameter("wst", getId()); - query.setParameter("start", range.getA()); - query.setParameter("end", range.getB()); + query.setParameter("start", new BigDecimal(fromKm)); + query.setParameter("end", new BigDecimal(toKm)); List<Object []> results = query.list();