[PATCH 3 of 5] SedimentLoadAccess: Slightly improved readability

Wald Commits scm-commit at wald.intevation.org
Thu Nov 7 09:47:13 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1383813800 -3600
# Node ID b60485a58d7326807ed6d07fd70e25946e63d016
# Parent  d2867dc7963f7ef3af46a785c212111ecca74455
SedimentLoadAccess: Slightly improved readability.

diff -r d2867dc7963f -r b60485a58d73 artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java	Thu Nov 07 09:42:19 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java	Thu Nov 07 09:43:20 2013 +0100
@@ -60,36 +60,35 @@
     }
 
     public int[][] getEpochs() {
-        if (getYearEpoch().equals("epoch") ||
-            getYearEpoch().equals("off_epoch")
-        ) {
-            String data = getString("epochs");
-
-            if (data == null) {
-                logger.warn("No 'epochs' parameter specified!");
-                return null;
-            }
-
-            String[] parts = data.split(";");
-
-            int[][] list = new int[parts.length][];
-
-            for (int i = 0; i < parts.length; i++) {
-                String[] values = parts[i].split(",");
-                TIntArrayList ints = new TIntArrayList();
-                try {
-                    ints.add(Integer.parseInt(values[0]));
-                    ints.add(Integer.parseInt(values[1]));
-                    list[i] = ints.toNativeArray();
-                }
-                catch (NumberFormatException nfe) {
-                    logger.warn("Cannot parse int from string: '" + values + "'");
-                }
-            }
-            return list;
+        if (!getYearEpoch().equals("epoch") &&
+            !getYearEpoch().equals("off_epoch")) {
+            return null;
         }
 
-        return null;
+        String data = getString("epochs");
+
+        if (data == null) {
+            logger.warn("No 'epochs' parameter specified!");
+            return null;
+        }
+
+        String[] parts = data.split(";");
+
+        int[][] list = new int[parts.length][];
+
+        for (int i = 0; i < parts.length; i++) {
+            String[] values = parts[i].split(",");
+            TIntArrayList ints = new TIntArrayList();
+            try {
+                ints.add(Integer.parseInt(values[0]));
+                ints.add(Integer.parseInt(values[1]));
+                list[i] = ints.toNativeArray();
+            }
+            catch (NumberFormatException nfe) {
+                logger.warn("Cannot parse int from string: '" + values + "'");
+            }
+        }
+        return list;
     }
 
     /** Returns the selected unit (t/a or m3/a). */


More information about the Dive4elements-commits mailing list