teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.model.minfo; raimund@3755: raimund@3755: import java.util.Date; raimund@3755: import java.util.Map; raimund@3755: felix@6757: import org.apache.log4j.Logger; raimund@3758: felix@6757: /** A measurement of the bed quality, serving different diameter at given km. */ raimund@3755: public class QualityMeasurement { teichmann@8202: private static Logger log = Logger.getLogger(QualityMeasurement.class); raimund@3755: raimund@3758: private double km; raimund@3758: private Date date; raimund@3758: private double depth1; raimund@3758: private double depth2; raimund@3755: private Map charDiameter; raimund@3755: felix@6766: private QualityMeasurement() { raimund@3755: raimund@3755: } raimund@3755: raimund@3755: public QualityMeasurement( raimund@3755: double km, raimund@3755: Date date, raimund@3758: double depth1, raimund@3758: double depth2, raimund@3758: Map diameter) { raimund@3755: this.setKm(km); raimund@3755: this.setDate(date); raimund@3758: this.depth1 = depth1; raimund@3758: this.depth2 = depth2; raimund@3755: this.setDiameter(diameter); raimund@3755: } raimund@3755: raimund@3755: public double getKm() { raimund@3755: return km; raimund@3755: } raimund@3755: raimund@3755: public void setKm(double km) { raimund@3755: this.km = km; raimund@3755: } raimund@3755: raimund@3755: public Date getDate() { raimund@3755: return date; raimund@3755: } raimund@3755: raimund@3755: public void setDate(Date date) { raimund@3755: this.date = date; raimund@3755: } raimund@3755: raimund@3755: public Map getAllDiameter() { raimund@3755: return charDiameter; raimund@3755: } raimund@3755: raimund@3755: public void setDiameter(Map charDiameter) { raimund@3755: this.charDiameter = charDiameter; raimund@3755: } raimund@3755: felix@6757: /** felix@6757: * Get the stored diameter for given key (e.g. d10). felix@6757: * @return NaN if no data found in this measurement. felix@6757: */ raimund@3755: public double getDiameter(String key) { felix@6757: Double diameter = charDiameter.get(key); felix@6757: if (diameter == null) { teichmann@8202: log.warn("No Diameter at km " + km + " for " + key); felix@6757: } felix@6757: return (diameter != null) ? diameter : Double.NaN; raimund@3755: } raimund@3755: raimund@3755: public void setDiameter(String key, double value) { raimund@3755: charDiameter.put(key, value); raimund@3755: } raimund@3758: raimund@3758: public double getDepth1() { raimund@3758: return depth1; raimund@3758: } raimund@3758: raimund@3758: public void setDepth1(double depth1) { raimund@3758: this.depth1 = depth1; raimund@3758: } raimund@3758: raimund@3758: public double getDepth2() { raimund@3758: return depth2; raimund@3758: } raimund@3758: raimund@3758: public void setDepth2(double depth2) { raimund@3758: this.depth2 = depth2; raimund@3758: } raimund@3755: }