Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java @ 9176:1614cb14308f
Work on calculations for S-Info flood duration workflow
author | mschaefer |
---|---|
date | Mon, 25 Jun 2018 19:21:11 +0200 |
parents | 95643dffd006 |
children | 51b316de0d64 |
rev | line source |
---|---|
9050 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9054
95643dffd006
rename grounding->collision; inundation_duration->flood_duration
gernotbelger
parents:
9053
diff
changeset
|
9 package org.dive4elements.river.artifacts.sinfo.flood_duration; |
9050 | 10 |
9053 | 11 import java.util.ArrayList; |
12 import java.util.List; | |
13 | |
14 import org.dive4elements.river.artifacts.states.RadioSelect; | |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
15 import org.dive4elements.river.model.Attribute.AttributeKey; |
9050 | 16 |
17 /** | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | |
9053 | 20 public class RiversideRadioChoice extends RadioSelect { |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
21 |
9050 | 22 private static final long serialVersionUID = 1L; |
23 | |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
24 /***** TYPES *****/ |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
25 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
26 public enum RiversideChoiceKey { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
27 NONE("", AttributeKey.NONE), // |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
28 LEFT("state.sinfo.riverside.left", AttributeKey.LEFT), // |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
29 RIGHT("state.sinfo.riverside.right", AttributeKey.RIGHT), // |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
30 BOTH("state.sinfo.riverside.both", AttributeKey.UNKNOWN); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
31 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
32 private final String key; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
33 private final AttributeKey attributeKey; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
34 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
35 RiversideChoiceKey(final String key, final AttributeKey attributeKey) { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
36 this.key = key; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
37 this.attributeKey = attributeKey; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
38 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
39 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
40 public static RiversideChoiceKey fromKey(final String key) { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
41 for (final RiversideChoiceKey v : values()) { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
42 if (key.equalsIgnoreCase(v.key)) |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
43 return v; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
44 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
45 return NONE; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
46 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
47 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
48 public String getKey() { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
49 return this.key; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
50 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
51 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
52 public AttributeKey getAttributeKey() { |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
53 return this.attributeKey; |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
54 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
55 } |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
56 |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
57 /***** CONSTRUCTORS *****/ |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
58 |
9053 | 59 public RiversideRadioChoice() { |
60 super(); | |
9050 | 61 } |
9053 | 62 |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
63 /***** METHODS *****/ |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
64 |
9053 | 65 @Override |
66 protected List<String> makeEntries() { | |
67 final List<String> entries = new ArrayList<>(); | |
9176
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
68 entries.add(RiversideChoiceKey.LEFT.getKey()); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
69 entries.add(RiversideChoiceKey.RIGHT.getKey()); |
1614cb14308f
Work on calculations for S-Info flood duration workflow
mschaefer
parents:
9054
diff
changeset
|
70 entries.add(RiversideChoiceKey.BOTH.getKey()); |
9053 | 71 return entries; |
72 } | |
73 | |
9050 | 74 } |