ingo@2713: package de.intevation.flys.artifacts.model; ingo@2713: ingo@2713: import java.io.Serializable; ingo@2713: ingo@2713: import gnu.trove.TDoubleArrayList; ingo@2713: ingo@2714: import de.intevation.artifacts.CallContext; ingo@2714: ingo@2714: import de.intevation.flys.artifacts.resources.Resources; ingo@2714: ingo@2713: ingo@2713: public class MiddleBedHeightData implements Serializable { ingo@2713: ingo@2714: public static final String I18N_SINGLE_NAME = "facet.bedheight_middle.single"; ingo@2714: public static final String I18N_EPOCH_NAME = "facet.bedheight_middle.epoch"; ingo@2714: ingo@2713: private int startYear; ingo@2713: private int endYear; ingo@2713: private String evaluatedBy; ingo@2713: private String description; ingo@2713: ingo@2713: private TDoubleArrayList km; ingo@2713: private TDoubleArrayList middleHeight; ingo@2713: private TDoubleArrayList uncertainty; ingo@2713: private TDoubleArrayList soundingWidth; ingo@2713: private TDoubleArrayList dataGap; ingo@2713: private TDoubleArrayList width; ingo@2713: ingo@2713: ingo@2713: protected MiddleBedHeightData(int start, int end, String eval, String desc) { ingo@2713: this.startYear = start; ingo@2713: this.endYear = end; ingo@2713: this.evaluatedBy = eval; ingo@2713: this.description = desc; ingo@2713: ingo@2713: this.km = new TDoubleArrayList(); ingo@2713: this.middleHeight = new TDoubleArrayList(); ingo@2713: this.uncertainty = new TDoubleArrayList(); ingo@2713: this.soundingWidth = new TDoubleArrayList(); ingo@2713: this.dataGap = new TDoubleArrayList(); ingo@2713: this.width = new TDoubleArrayList(); ingo@2713: } ingo@2713: ingo@2713: ingo@2713: public int getStartYear() { ingo@2713: return startYear; ingo@2713: } ingo@2713: ingo@2713: public int getEndYear() { ingo@2713: return endYear; ingo@2713: } ingo@2713: ingo@2713: public String getEvaluatedBy() { ingo@2713: return evaluatedBy; ingo@2713: } ingo@2713: ingo@2713: public String getDescription() { ingo@2713: return description; ingo@2713: } ingo@2713: ingo@2713: ingo@2713: public void addKM(double km) { ingo@2713: this.km.add(km); ingo@2713: } ingo@2713: ingo@2713: public double getKM(int idx) { ingo@2713: return km.get(idx); ingo@2713: } ingo@2713: ingo@2713: public void addMiddleHeight(double middleHeight) { ingo@2713: this.middleHeight.add(middleHeight); ingo@2713: } ingo@2713: ingo@2713: public double getMiddleHeight(int idx) { ingo@2713: return middleHeight.get(idx); ingo@2713: } ingo@2713: ingo@2713: public void addUncertainty(double uncertainty) { ingo@2713: this.uncertainty.add(uncertainty); ingo@2713: } ingo@2713: ingo@2713: public double getUncertainty(int idx) { ingo@2713: return uncertainty.get(idx); ingo@2713: } ingo@2713: ingo@2713: public void addSoundingWidth(double soundingWidth) { ingo@2713: this.soundingWidth.add(soundingWidth); ingo@2713: } ingo@2713: ingo@2713: public double getSoundingWidth(int idx) { ingo@2713: return soundingWidth.get(idx); ingo@2713: } ingo@2713: ingo@2713: public void addDataGap(double gap) { ingo@2713: this.dataGap.add(gap); ingo@2713: } ingo@2713: ingo@2713: public double getDataGap(int idx) { ingo@2713: return dataGap.get(idx); ingo@2713: } ingo@2713: ingo@2713: public void addWidth(double width) { ingo@2713: this.width.add(width); ingo@2713: } ingo@2713: ingo@2713: public double getWidth(int idx) { ingo@2713: return width.get(idx); ingo@2713: } ingo@2713: ingo@2713: public int size() { ingo@2713: return km.size(); ingo@2713: } ingo@2713: ingo@2713: ingo@2713: public double[][] getMiddleHeightsPoints() { ingo@2713: double[][] points = new double[2][size()]; ingo@2713: ingo@2713: for (int i = 0, n = size(); i < n; i++) { ingo@2713: points[0][i] = getKM(i); ingo@2713: points[1][i] = getMiddleHeight(i); ingo@2713: } ingo@2713: ingo@2713: return points; ingo@2713: } ingo@2714: ingo@2714: ingo@2714: public String getSoundingName(CallContext context) { ingo@2714: if (getStartYear() == getEndYear()) { ingo@2714: return Resources.getMsg( ingo@2714: context.getMeta(), ingo@2714: I18N_SINGLE_NAME, ingo@2714: I18N_SINGLE_NAME, ingo@2714: new Object[] { getStartYear() } ingo@2714: ); ingo@2714: } ingo@2714: else { ingo@2714: return Resources.getMsg( ingo@2714: context.getMeta(), ingo@2714: I18N_EPOCH_NAME, ingo@2714: I18N_EPOCH_NAME, ingo@2714: new Object[] { getStartYear(), getEndYear() } ingo@2714: ); ingo@2714: } ingo@2714: } ingo@2713: } sascha@3083: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :