comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java @ 7530:b60485a58d73

SedimentLoadAccess: Slightly improved readability.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 07 Nov 2013 09:43:20 +0100
parents d828b659a593
children 9dce39cffab3
comparison
equal deleted inserted replaced
7529:d2867dc7963f 7530:b60485a58d73
58 } 58 }
59 return null; 59 return null;
60 } 60 }
61 61
62 public int[][] getEpochs() { 62 public int[][] getEpochs() {
63 if (getYearEpoch().equals("epoch") || 63 if (!getYearEpoch().equals("epoch") &&
64 getYearEpoch().equals("off_epoch") 64 !getYearEpoch().equals("off_epoch")) {
65 ) { 65 return null;
66 String data = getString("epochs");
67
68 if (data == null) {
69 logger.warn("No 'epochs' parameter specified!");
70 return null;
71 }
72
73 String[] parts = data.split(";");
74
75 int[][] list = new int[parts.length][];
76
77 for (int i = 0; i < parts.length; i++) {
78 String[] values = parts[i].split(",");
79 TIntArrayList ints = new TIntArrayList();
80 try {
81 ints.add(Integer.parseInt(values[0]));
82 ints.add(Integer.parseInt(values[1]));
83 list[i] = ints.toNativeArray();
84 }
85 catch (NumberFormatException nfe) {
86 logger.warn("Cannot parse int from string: '" + values + "'");
87 }
88 }
89 return list;
90 } 66 }
91 67
92 return null; 68 String data = getString("epochs");
69
70 if (data == null) {
71 logger.warn("No 'epochs' parameter specified!");
72 return null;
73 }
74
75 String[] parts = data.split(";");
76
77 int[][] list = new int[parts.length][];
78
79 for (int i = 0; i < parts.length; i++) {
80 String[] values = parts[i].split(",");
81 TIntArrayList ints = new TIntArrayList();
82 try {
83 ints.add(Integer.parseInt(values[0]));
84 ints.add(Integer.parseInt(values[1]));
85 list[i] = ints.toNativeArray();
86 }
87 catch (NumberFormatException nfe) {
88 logger.warn("Cannot parse int from string: '" + values + "'");
89 }
90 }
91 return list;
93 } 92 }
94 93
95 /** Returns the selected unit (t/a or m3/a). */ 94 /** Returns the selected unit (t/a or m3/a). */
96 public String getUnit () { 95 public String getUnit () {
97 if (unit == null) { 96 if (unit == null) {

http://dive4elements.wald.intevation.org