diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java @ 8024:963ede7b32bb

Renamed SedimentLoad to SedimentLoadLSData to make place for SedimentLoad in backend.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 09 Jul 2014 17:33:57 +0200
parents b4117b8adb79
children fdb26fe898dc
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Wed Jul 09 17:10:18 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Wed Jul 09 17:33:57 2014 +0200
@@ -145,8 +145,8 @@
      * @param[out] resLoad resulting SedimentLoad.
      */
     private void calculateEpochKm(
-        List<SedimentLoad> epochLoads,
-        SedimentLoad resLoad,
+        List<SedimentLoadLSData> epochLoads,
+        SedimentLoadLSData resLoad,
         double km
     ) {
         int cSum = 0;
@@ -155,7 +155,7 @@
         int ssSum = 0;
         int ssbSum = 0;
         int sseSum = 0;
-        for (SedimentLoad load : epochLoads) {
+        for (SedimentLoadLSData load : epochLoads) {
             SedimentLoadFraction f = load.getFraction(km);
             if (f.getCoarse() > 0d) {
                 double c = makeNaN0(resLoad.getFraction(km).getCoarse());
@@ -219,7 +219,7 @@
      * @param i index of epoch (if multiple given).
      */
     private SedimentLoadResult calculateEpoch(int i) {
-        List<SedimentLoad> epochLoads = new ArrayList<SedimentLoad>();
+        List<SedimentLoadLSData> epochLoads = new ArrayList<SedimentLoadLSData>();
         for (int j = epoch[i][0]; j <= epoch[i][1]; j++) {
             epochLoads.add(SedimentLoadFactory.getLoadWithData(
                 this.river,
@@ -230,10 +230,10 @@
                 j)); //eyear
         }
 
-        SedimentLoad resLoad = new SedimentLoad();
+        SedimentLoadLSData resLoad = new SedimentLoadLSData();
         TDoubleArrayList kms = new TDoubleArrayList();
 
-        for (SedimentLoad load : epochLoads) {
+        for (SedimentLoadLSData load : epochLoads) {
             for (double km : load.getKms()) {
                 if (!kms.contains(km)) {
                     kms.add(km);
@@ -247,7 +247,7 @@
         resLoad.setDescription("");
         resLoad.setEpoch(true);
 
-        SedimentLoad sl = calculateTotalLoad(resLoad, this.epoch[i][0]);
+        SedimentLoadLSData sl = calculateTotalLoad(resLoad, this.epoch[i][0]);
 
         if (this.unit.equals("m3_per_a")) {
             sl = calculateUnit(sl, this.epoch[i][0]);
@@ -264,7 +264,7 @@
      * @param i index in epochs.
      */
     private SedimentLoadResult calculateOffEpoch(int i) {
-        SedimentLoad load = SedimentLoadFactory.getLoadWithData(
+        SedimentLoadLSData load = SedimentLoadFactory.getLoadWithData(
             this.river,
             this.yearEpoch,
             kmLow,
@@ -272,9 +272,9 @@
             this.epoch[i][0],
             this.epoch[i][1]);
         SedimentLoadResult result;
-        SedimentLoad sl = calculateTotalLoad(load, this.epoch[i][0]);
+        SedimentLoadLSData sl = calculateTotalLoad(load, this.epoch[i][0]);
         if (unit.equals("m3_per_a")) {
-            SedimentLoad slu = calculateUnit(sl, epoch[i][0]);
+            SedimentLoadLSData slu = calculateUnit(sl, epoch[i][0]);
             result = new SedimentLoadResult(
                 this.epoch[i][0],
                 this.epoch[i][1],
@@ -296,7 +296,7 @@
      * @param y year, e.g. 1980
      */
     private SedimentLoadResult calculateYear(int y) {
-        SedimentLoad load = SedimentLoadFactory.getLoadWithData(
+        SedimentLoadLSData load = SedimentLoadFactory.getLoadWithData(
             this.river,
             this.yearEpoch,
             this.kmLow,
@@ -305,9 +305,9 @@
             y);
 
         SedimentLoadResult result;
-        SedimentLoad sl = calculateTotalLoad(load, y);
+        SedimentLoadLSData sl = calculateTotalLoad(load, y);
         if (unit.equals("m3_per_a")) {
-            SedimentLoad slu = calculateUnit(sl, y);
+            SedimentLoadLSData slu = calculateUnit(sl, y);
             result = new SedimentLoadResult(y, 0, slu);
         }
         else {
@@ -317,7 +317,7 @@
     }
 
     /** Add up the loads of a year. */
-    private SedimentLoad calculateTotalLoad(SedimentLoad load, int year) {
+    private SedimentLoadLSData calculateTotalLoad(SedimentLoadLSData load, int year) {
         logger.debug("calculateTotalLoad");
         boolean problemThisYear = false;
         if (!load.hasCoarse()) {
@@ -361,9 +361,9 @@
      * @param load SedimentLoad to add total values (and ranges) to.
      * @return input param load, with total values set.
      */
-    private SedimentLoad partialTotal(SedimentLoad load) {
+    private SedimentLoadLSData partialTotal(SedimentLoadLSData load) {
         // The load with balanced ranges, will be returned.
-        SedimentLoad fairLoad = load;
+        SedimentLoadLSData fairLoad = load;
 
         Range lastOtherRange = null;
         double lastOtherValue = 0d;
@@ -521,7 +521,7 @@
      *
      * @return parameter load with transformed values.
      */
-    private SedimentLoad calculateUnit(SedimentLoad load, int year) {
+    private SedimentLoadLSData calculateUnit(SedimentLoadLSData load, int year) {
         SedimentDensity density =
             SedimentDensityFactory.getSedimentDensity(river, kmLow, kmUp, year);
 

http://dive4elements.wald.intevation.org