annotate artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents 868f55932fe6
children 6d8d7425a6b5
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4828
diff changeset
9 package org.dive4elements.river.artifacts.access;
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
11 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4828
diff changeset
12 import org.dive4elements.river.artifacts.states.SoundingsSelect;
4150
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
13
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import gnu.trove.TIntArrayList;
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.apache.log4j.Logger;
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
4826
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
19 public class BedHeightAccess
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
20 extends RangeAccess
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
21 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7919
diff changeset
22 private static final Logger log = Logger.getLogger(BedHeightAccess.class);
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
23
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
24 private int[] singleIDs;
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
25 private int[] epochIDs;
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
26
7356
534850c9fabc Minor BedHeightAccess refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6102
diff changeset
27 private String yearEpoch;
534850c9fabc Minor BedHeightAccess refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6102
diff changeset
28
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
29 private String type;
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
30
7356
534850c9fabc Minor BedHeightAccess refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6102
diff changeset
31 private Integer heightId;
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
32
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
33 private Integer time;
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
34
6101
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
35 public BedHeightAccess(D4EArtifact artifact) {
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
36 super(artifact);
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
37 }
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
38
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
39
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
40 public Double getLowerKM() {
4826
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
41 // TODO update callers
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
42 return getFrom();
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 }
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
44
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
45
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public Double getUpperKM() {
4826
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
47 // TODO update callers
a3dc382bc1ca BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4655
diff changeset
48 return getTo();
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 }
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
50
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
51
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 public int[] getBedHeightSingleIDs() {
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
53 if (singleIDs == null) {
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
54 String data = getString("soundings");
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
55
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
56 if (data == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7919
diff changeset
57 log.warn("No 'soundings' parameter specified!");
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
58 return null;
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
59 }
4150
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
60 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7919
diff changeset
61 log.debug("getBedHeightSingleIDs(): data=" + data);
4150
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
62 }
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
63
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
64 String[] parts = data.split(";");
3232
cdbc457e23e2 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3230
diff changeset
65
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
66 TIntArrayList ids = new TIntArrayList();
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
68 for (String part: parts) {
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
69 if (part.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) {
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
70 String tmp = part.replace(SoundingsSelect.PREFIX_SINGLE, "");
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
71
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
72 try {
4150
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
73 int i = Integer.parseInt(tmp);
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
74 if (!ids.contains(i)) {
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
75 ids.add(i);
0f60efc39953 Workaround for #961
Christian Lins <christian.lins@intevation.de>
parents: 3614
diff changeset
76 }
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
77 }
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
78 catch (NumberFormatException nfe) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7919
diff changeset
79 log.warn("Cannot parse int from string: '" + tmp + "'");
3258
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
80 }
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
81 }
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
82 }
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
83
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
84 singleIDs = ids.toNativeArray();
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
85 }
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
86
3c006a53e551 Replaced tabs with four spaces each.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3232
diff changeset
87 return singleIDs;
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
91 public String getType() {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
92 if (type == null) {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
93 type = getString("type");
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3259
diff changeset
94 }
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
95 return type;
7356
534850c9fabc Minor BedHeightAccess refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6102
diff changeset
96 }
534850c9fabc Minor BedHeightAccess refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6102
diff changeset
97
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
98 public Integer getHeightId() {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
99 if (heightId == null) {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
100 heightId = getInteger("height_id");
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
101 }
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
102 return heightId;
4655
cd44d28d0fbc Move the access to artifact data to the Access object
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4150
diff changeset
103 }
cd44d28d0fbc Move the access to artifact data to the Access object
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4150
diff changeset
104
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
105 public Integer getTime() {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
106 if (time == null) {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
107 time = getInteger("time");
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
108 }
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7356
diff changeset
109 return time;
4655
cd44d28d0fbc Move the access to artifact data to the Access object
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4150
diff changeset
110 }
3230
b888c5eb65b3 Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
3259
9422b559b2d5 Added vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3258
diff changeset
112 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org