annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java @ 3762:0c978a80726a

Splitted up facets for porosity and density into two facets: a toplayer and a sublayer facet for each. BedQualityState will now create facets based on the calculation result. flys-artifacts/trunk@5464 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 14 Sep 2012 07:12:08 +0000
parents 312870fded7e
children 00aafe1fedd7
rev   line source
3749
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.access;
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3760
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
3 import java.util.Date;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
4 import java.util.LinkedList;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
5 import java.util.List;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
6
3749
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.flys.artifacts.FLYSArtifact;
3760
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
8 import de.intevation.flys.artifacts.model.DateRange;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
9
3749
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 public class BedQualityAccess extends Access {
3750
e560a9a10eb1 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3749
diff changeset
12
3760
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
13 private Double from;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
14 private Double to;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
15 private String river;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
16 private List<DateRange> ranges;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
17
3749
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 public BedQualityAccess(FLYSArtifact artifact) {
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 super(artifact);
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 }
3760
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
21
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
22 public double getFrom() {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
23 if (from == null) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
24 from = getDouble("ld_from");
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
25 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
26 return from.doubleValue();
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
27 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
28
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
29 public double getTo() {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
30 if (to == null) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
31 to = getDouble("ld_to");
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
32 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
33 return to.doubleValue();
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
34 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
35
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
36 public String getRiver() {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
37 if (river == null) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
38 river = getString("river");
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
39 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
40 return river;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
41 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
42
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
43 public List<DateRange> getDateRanges() {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
44 if (ranges == null) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
45 ranges = extractRanges(getString("periods"));
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
46 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
47 return ranges;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
48 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
49
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
50 private List<DateRange> extractRanges(String dateString) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
51 List<DateRange> list = new LinkedList<DateRange>();
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
52 String[] dates = dateString.split(";");
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
53 for (String s : dates) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
54 String[] pair = s.split(",");
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
55 try {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
56 long l1 = Long.parseLong(pair[0]);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
57 long l2 = Long.parseLong(pair[1]);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
58 Date first = new Date(l1);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
59 Date second = new Date(l2);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
60 DateRange dr = new DateRange(first, second);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
61 list.add(dr);
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
62 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
63 catch (NumberFormatException nfe) {
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
64 continue;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
65 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
66 }
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
67 return list;
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
68 }
3749
3dcc4feff243 Created the initial structure for MINFO bed quality chart generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
3760
312870fded7e Added result objects for minfo bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3750
diff changeset
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org