Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsFilterBuilder.java @ 3125:070b76fbae46
Parameters: Bring binarySearch with epsilon more to source of binarySearch of Collections.
flys-artifacts/trunk@4726 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 20 Jun 2012 14:24:52 +0000 |
parents | 0b86b005bb9a |
children | f12a8ed8d973 |
rev | line source |
---|---|
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.flys.artifacts.model.FixingsOverview.AndFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.flys.artifacts.model.FixingsOverview.DateFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.flys.artifacts.model.FixingsOverview.DateRangeFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.artifacts.model.FixingsOverview.IdFilter; |
3121
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
10 import de.intevation.flys.artifacts.model.FixingsOverview.IdsFilter; |
3006
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
11 import de.intevation.flys.artifacts.model.FixingsOverview.KmFilter; |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.model.FixingsOverview.NotFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.model.FixingsOverview.OrFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.model.FixingsOverview.Range; |
3008
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
15 import de.intevation.flys.artifacts.model.FixingsOverview.SectorFilter; |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.model.FixingsOverview.SectorRangeFilter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 import java.text.ParsePosition; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 import java.text.SimpleDateFormat; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import java.util.ArrayList; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import java.util.Date; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 import java.util.List; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 import org.apache.log4j.Logger; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 import org.w3c.dom.Document; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 import org.w3c.dom.Element; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 import org.w3c.dom.Node; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 import org.w3c.dom.NodeList; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 public class FixingsFilterBuilder |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 private static Logger log = Logger.getLogger(FixingsFilterBuilder.class); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 protected Filter filter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 protected Range range; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 protected Document document; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public FixingsFilterBuilder() { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 public FixingsFilterBuilder(Document document) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 this.document = document; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 public Filter getFilter() { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 if (filter == null) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 filter = buildFilter(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 return filter; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 public Range getRange() { |
2613
2e129754d450
Fixed NPE bug in filter builder for fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2608
diff
changeset
|
56 if (range == null) { |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 range = buildRange(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 return range; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 public Document getDocument() { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 return document; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 protected Range buildRange() { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 NodeList ranges = document.getElementsByTagName("range"); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 if (ranges.getLength() < 1) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 return FixingsOverview.FULL_EXTENT; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 Element range = (Element)ranges.item(0); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 String from = range.getAttribute("from").trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 String to = range.getAttribute("to" ).trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 double start = -Double.MAX_VALUE; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 double end = Double.MAX_VALUE; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 if (from.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 try { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 start = Double.parseDouble(from); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 catch (NumberFormatException nfe) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 log.warn("Invalid from value: " + from); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 if (to.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 try { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 end = Double.parseDouble(to); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 catch (NumberFormatException nfe) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 log.warn("Invalid to value: " + to); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 if (start > end) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 double t = start; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 start = end; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 end = t; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 return new Range(start, end); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 protected Filter buildFilter() { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 NodeList filters = document.getElementsByTagName("filter"); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 return filters.getLength() < 1 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 ? FixingsOverview.ACCEPT |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 : buildFilter((Element)filters.item(0)); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 protected static Filter buildFilter(Element root) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 List<Filter> filters = buildRecursiveFilter(root); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 switch (filters.size()) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 case 0: return FixingsOverview.ACCEPT; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 case 1: return filters.get(0); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 default: return new AndFilter(filters); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 protected static final Date parseDate(String text) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 SimpleDateFormat format = |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 new SimpleDateFormat(FixingsOverview.DATE_FORMAT); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 return format.parse(text, new ParsePosition(0)); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 protected static List<Filter> buildRecursiveFilter(Element root) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 List<Filter> filters = new ArrayList<Filter>(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 NodeList children = root.getChildNodes(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 for (int i = 0, N = children.getLength(); i < N; ++i) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 Node child = children.item(i); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 if (child.getNodeType() != Node.ELEMENT_NODE) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 continue; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 Element element = (Element)child; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 String name = element.getLocalName(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 if ("and".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 filters.add(new AndFilter(buildRecursiveFilter(element))); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 else if ("or".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 filters.add(new OrFilter(buildRecursiveFilter(element))); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 else if ("not".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 List<Filter> childrenFilters = buildRecursiveFilter(element); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 if (!childrenFilters.isEmpty()) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 filters.add(new NotFilter(childrenFilters.get(0))); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 else if ("column".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 String cid = element.getAttribute("cid").trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 if (cid.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 try { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 filters.add(new IdFilter(Integer.parseInt(cid))); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 catch (NumberFormatException nfe) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 log.warn(nfe); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 } |
3121
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
169 else if ("columns".equals(name)) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
170 String cidsS = element.getAttribute("cids").trim(); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
171 String [] parts = cidsS.split("\\s+"); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
172 List<Integer> ids = new ArrayList<Integer>(); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
173 for (String part: parts) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
174 try { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
175 ids.add(Integer.valueOf(part)); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
176 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
177 catch (NumberFormatException nfe) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
178 log.warn(nfe); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
179 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
180 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
181 int [] cids = new int[ids.size()]; |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
182 for (int j = 0; j < cids.length; ++j) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
183 cids[i] = ids.get(j); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
184 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
185 filters.add(new IdsFilter(cids)); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
186 } |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 else if ("date".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 String when = element.getAttribute("when").trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 if (when.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 Date date = parseDate(when); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 if (date != null) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
192 filters.add(new DateFilter(date)); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 else if ("date-range".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 String from = element.getAttribute("from").trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
198 String to = element.getAttribute("to" ).trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 if (from.length() > 0 && to.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 Date start = parseDate(from); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 Date end = parseDate(to); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 if (start != null && end != null) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
203 filters.add(new DateRangeFilter(start, end)); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 else if ("sector-range".equals(name)) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 String from = element.getAttribute("from").trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 String to = element.getAttribute("to" ).trim(); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 if (from.length() > 0 && to.length() > 0) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 try { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 filters.add(new SectorRangeFilter( |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 Integer.parseInt(from), |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 Integer.parseInt(to))); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 catch (NumberFormatException nfe) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
217 log.warn(nfe); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
220 } |
3008
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
221 else if ("sector".equals(name)) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
222 String value = element.getAttribute("value").trim(); |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
223 if (value.length() > 0) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
224 try { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
225 filters.add(new SectorFilter(Integer.parseInt(value))); |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
226 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
227 catch (NumberFormatException nfe) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
228 log.warn(nfe); |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
229 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
230 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
231 } |
3006
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
232 else if ("position".equals(name)) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
233 String km = element.getAttribute("km").trim(); |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
234 if (km.length() > 0) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
235 try { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
236 filters.add(new KmFilter(Double.parseDouble(km))); |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
237 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
238 catch (NumberFormatException nfe) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
239 log.warn(nfe); |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
240 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
241 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
242 } |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
245 return filters; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
246 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
247 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |