annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java @ 8587:07c9ac22f611

(issue1755) Generalise BedQuality result handling The bedquality calculation now produces a result for each time period which has BedQualityResultValues for each specific result type. Formally this was split up in density, porosity and diameter classes with some bedload diameter classes mixed in for extra fun. The intent of this commit is to allow more shared code and generic access patterns to the BedQuality results.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Mar 2015 18:42:08 +0100
parents 73a4c3c202e5
children 9fa5c66073e7
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: 5701
diff changeset
9 package org.dive4elements.river.artifacts.states.minfo;
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
13 import org.dive4elements.artifacts.Artifact;
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
14
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
15 import org.dive4elements.river.artifacts.D4EArtifact;
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
17 import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
18 import org.dive4elements.river.artifacts.states.DefaultState;
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
21 /** State in which to fetch years for sedminent load calculation. */
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 public class SedimentLoadYearSelect
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 extends DefaultState
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
25 /** The log used in this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6101
diff changeset
26 private static Logger log = Logger.getLogger(SedimentLoadYearSelect.class);
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 /**
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 * The default constructor that initializes an empty State object.
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 */
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 public SedimentLoadYearSelect() {
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 }
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
35
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
36 /** Year Select Widget. */
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 @Override
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 protected String getUIProvider() {
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 return "minfo.sedimentload_year_select";
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 }
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
42
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
43 @Override
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
44 public boolean validate(Artifact artifact)
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
45 throws IllegalArgumentException
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
46 {
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
47 SedimentLoadAccess access = new SedimentLoadAccess((D4EArtifact) artifact);
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
48
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
49 // Second year should be later than first.
8532
73a4c3c202e5 (issue1051) Use a list of single years in SedimentLoadYear mode
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
50 if (access.getYears() != null && access.getYears()[1] < access.getYears()[0])
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
51 throw new IllegalArgumentException("error_years_wrong");
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
52
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
53 return true;
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
54 }
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 }
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
56 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org