comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java @ 3258:3c006a53e551

Replaced tabs with four spaces each. flys-artifacts/trunk@4895 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 08 Jul 2012 08:43:13 +0000
parents cdbc457e23e2
children 9422b559b2d5
comparison
equal deleted inserted replaced
3257:2aca387333d6 3258:3c006a53e551
8 import de.intevation.flys.artifacts.states.SoundingsSelect; 8 import de.intevation.flys.artifacts.states.SoundingsSelect;
9 9
10 10
11 public class BedHeightAccess extends Access { 11 public class BedHeightAccess extends Access {
12 12
13 private static final Logger logger = Logger.getLogger(BedHeightAccess.class); 13 private static final Logger logger = Logger.getLogger(BedHeightAccess.class);
14
15 private int[] singleIDs;
16 private int[] epochIDs;
17
18 private Double lowerKM;
19 private Double upperKM;
14 20
15 21
16 private int[] singleIDs; 22 public BedHeightAccess(FLYSArtifact artifact) {
17 private int[] epochIDs; 23 super(artifact);
18 24 }
19 private Double lowerKM;
20 private Double upperKM;
21 25
22 26
23 public BedHeightAccess(FLYSArtifact artifact) { 27 public Double getLowerKM() {
24 super(artifact); 28 if (lowerKM == null) {
25 } 29 lowerKM = getDouble("ld_from");
30 }
26 31
27 32 return lowerKM;
28 public Double getLowerKM() {
29 if (lowerKM == null) {
30 lowerKM = getDouble("ld_from");
31 }
32
33 return lowerKM;
34 } 33 }
35 34
36 35
37 public Double getUpperKM() { 36 public Double getUpperKM() {
38 if (upperKM == null) { 37 if (upperKM == null) {
39 upperKM = getDouble("ld_to"); 38 upperKM = getDouble("ld_to");
40 } 39 }
41 40
42 return upperKM; 41 return upperKM;
43 } 42 }
44 43
45 44
46 public int[] getBedHeightSingleIDs() { 45 public int[] getBedHeightSingleIDs() {
47 if (singleIDs == null) { 46 if (singleIDs == null) {
48 String data = getString("soundings"); 47 String data = getString("soundings");
49 48
50 if (data == null) { 49 if (data == null) {
51 logger.warn("No 'soundings' parameter specified!"); 50 logger.warn("No 'soundings' parameter specified!");
52 return null; 51 return null;
53 } 52 }
54 53
55 String[] parts = data.split(";"); 54 String[] parts = data.split(";");
56 55
57 TIntArrayList ids = new TIntArrayList(); 56 TIntArrayList ids = new TIntArrayList();
58 57
59 for (String part: parts) { 58 for (String part: parts) {
60 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { 59 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) {
61 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, ""); 60 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, "");
62 61
63 try { 62 try {
64 ids.add(Integer.parseInt(tmp)); 63 ids.add(Integer.parseInt(tmp));
65 } 64 }
66 catch (NumberFormatException nfe) { 65 catch (NumberFormatException nfe) {
67 logger.warn("Cannot parse int from string: '" + tmp + "'"); 66 logger.warn("Cannot parse int from string: '" + tmp + "'");
68 } 67 }
69 } 68 }
70 } 69 }
71 70
72 singleIDs = ids.toNativeArray(); 71 singleIDs = ids.toNativeArray();
73 } 72 }
74 73
75 return singleIDs; 74 return singleIDs;
76 } 75 }
77 76
78 77
79 public int[] getBedHeightEpochIDs() { 78 public int[] getBedHeightEpochIDs() {
80 if (epochIDs == null) { 79 if (epochIDs == null) {
81 String data = getString("soundings"); 80 String data = getString("soundings");
82 81
83 if (data == null) { 82 if (data == null) {
84 logger.warn("No 'soundings' parameter specified!"); 83 logger.warn("No 'soundings' parameter specified!");
85 return null; 84 return null;
86 } 85 }
87 86
88 String[] parts = data.split(";"); 87 String[] parts = data.split(";");
89 88
90 TIntArrayList ids = new TIntArrayList(); 89 TIntArrayList ids = new TIntArrayList();
91 90
92 for (String part: parts) { 91 for (String part: parts) {
93 if (part.indexOf(SoundingsSelect.PREFIX_EPOCH) >= 0) { 92 if (part.indexOf(SoundingsSelect.PREFIX_EPOCH) >= 0) {
94 String tmp = part.replace(SoundingsSelect.PREFIX_EPOCH, ""); 93 String tmp = part.replace(SoundingsSelect.PREFIX_EPOCH, "");
95 94
96 try { 95 try {
97 ids.add(Integer.parseInt(tmp)); 96 ids.add(Integer.parseInt(tmp));
98 } 97 }
99 catch (NumberFormatException nfe) { 98 catch (NumberFormatException nfe) {
100 logger.warn("Cannot parse int from string: '" + tmp + "'"); 99 logger.warn("Cannot parse int from string: '" + tmp + "'");
101 } 100 }
102 } 101 }
103 } 102 }
104 103
105 epochIDs = ids.toNativeArray(); 104 epochIDs = ids.toNativeArray();
106 } 105 }
107 106
108 return epochIDs; 107 return epochIDs;
109 } 108 }
110 } 109 }

http://dive4elements.wald.intevation.org