comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoad.java @ 5831:bd047b71ab37

Repaired internal references
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 12:06:39 +0200
parents flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java@9df65e89195e
children
comparison
equal deleted inserted replaced
5830:160f53ee0870 5831:bd047b71ab37
1 package org.dive4elements.river.artifacts.model.minfo;
2
3 import java.util.Date;
4 import java.util.HashMap;
5 import java.util.Set;
6
7 import org.dive4elements.river.artifacts.model.NamedObjectImpl;
8
9 /** Gives access to Fractions (at kms). */
10 public class SedimentLoad
11 extends NamedObjectImpl
12 {
13 protected String description;
14 protected Date start;
15 protected Date end;
16 protected boolean isEpoch;
17
18 protected HashMap<Double, SedimentLoadFraction> kms;
19
20 public SedimentLoad() {
21 kms = new HashMap<Double, SedimentLoadFraction>();
22 }
23
24 public SedimentLoad(
25 String description,
26 Date start,
27 Date end,
28 boolean isEpoch
29 ) {
30 this();
31 this.description = description;
32 this.start = start;
33 this.end = end;
34 this.isEpoch = isEpoch;
35 }
36
37 public String getDescription() {
38 return description;
39 }
40
41 public void setDescription(String description) {
42 this.description = description;
43 }
44
45 public Date getStart() {
46 return start;
47 }
48
49 public void setStart(Date start) {
50 this.start = start;
51 }
52
53 public Date getEnd() {
54 return end;
55 }
56
57 public void setEnd(Date end) {
58 this.end = end;
59 }
60
61 public boolean isEpoch() {
62 return isEpoch;
63 }
64
65 public void setEpoch(boolean isEpoch) {
66 this.isEpoch = isEpoch;
67 }
68
69 public Set<Double> getKms() {
70 return kms.keySet();
71 }
72
73 public void addKm(double km, SedimentLoadFraction fraction) {
74 kms.put(km, fraction);
75 }
76
77 public SedimentLoadFraction getFraction(double km) {
78 if (kms.get(km) == null) {
79 return new SedimentLoadFraction();
80 }
81 return kms.get(km);
82 }
83
84 public void setCoarse(double km, double coarse) {
85 if (kms.containsKey(km)) {
86 kms.get(km).setCoarse(coarse);
87 }
88 else {
89 SedimentLoadFraction f = new SedimentLoadFraction();
90 f.setCoarse(coarse);
91 kms.put(km, f);
92 }
93 }
94
95 public void setFineMiddle(double km, double fine_middle) {
96 if (kms.containsKey(km)) {
97 kms.get(km).setFine_middle(fine_middle);
98 }
99 else {
100 SedimentLoadFraction f = new SedimentLoadFraction();
101 f.setFine_middle(fine_middle);
102 kms.put(km, f);
103 }
104 }
105
106 public void setSand(double km, double sand) {
107 if (kms.containsKey(km)) {
108 kms.get(km).setSand(sand);
109 }
110 else {
111 SedimentLoadFraction f = new SedimentLoadFraction();
112 f.setSand(sand);
113 kms.put(km, f);
114 }
115 }
116
117 public void setSuspSand(double km, double susp_sand) {
118 if (kms.containsKey(km)) {
119 kms.get(km).setSusp_sand(susp_sand);
120 }
121 else {
122 SedimentLoadFraction f = new SedimentLoadFraction();
123 f.setSusp_sand(susp_sand);
124 kms.put(km, f);
125 }
126 }
127
128 public void setSuspSandBed(double km, double susp_sand_bed) {
129 if (kms.containsKey(km)) {
130 kms.get(km).setSusp_sand_bed(susp_sand_bed);
131 }
132 else {
133 SedimentLoadFraction f = new SedimentLoadFraction();
134 f.setSusp_sand_bed(susp_sand_bed);
135 kms.put(km, f);
136 }
137 }
138
139 public void setSuspSediment(double km, double susp_sediment) {
140 if (kms.containsKey(km)) {
141 kms.get(km).setSusp_sediment(susp_sediment);
142 }
143 else {
144 SedimentLoadFraction f = new SedimentLoadFraction();
145 f.setSusp_sediment(susp_sediment);
146 kms.put(km, f);
147 }
148 }
149
150 public void setLoadTotal(double km, double total) {
151 if (kms.containsKey(km)) {
152 kms.get(km).setLoadTotal(total);
153 }
154 else {
155 SedimentLoadFraction f = new SedimentLoadFraction();
156 f.setLoadTotal(total);
157 kms.put(km, f);
158 }
159 }
160
161 public void setTotal(double km, double total) {
162 if (kms.containsKey(km)) {
163 kms.get(km).setTotal(total);
164 }
165 else {
166 SedimentLoadFraction f = new SedimentLoadFraction();
167 f.setTotal(total);
168 kms.put(km, f);
169 }
170 }
171
172 public boolean hasCoarse() {
173 for (SedimentLoadFraction slf : kms.values()) {
174 if (slf.getCoarse() > 0d) {
175 return true;
176 }
177 }
178 return false;
179 }
180
181 public boolean hasFineMiddle() {
182 for (SedimentLoadFraction slf : kms.values()) {
183 if (slf.getFine_middle() > 0d) {
184 return true;
185 }
186 }
187 return false;
188 }
189
190 public boolean hasSand() {
191 for (SedimentLoadFraction slf : kms.values()) {
192 if (slf.getSand() > 0d) {
193 return true;
194 }
195 }
196 return false;
197 }
198
199 public boolean hasSuspSand() {
200 for (SedimentLoadFraction slf : kms.values()) {
201 if (slf.getSusp_sand() > 0d) {
202 return true;
203 }
204 }
205 return false;
206 }
207
208 public boolean hasSuspSediment() {
209 for (SedimentLoadFraction slf : kms.values()) {
210 if (slf.getSusp_sediment() > 0d) {
211 return true;
212 }
213 }
214 return false;
215 }
216
217 public boolean hasTotalLoad() {
218 for (SedimentLoadFraction slf : kms.values()) {
219 if (slf.getLoadTotal() > 0d) {
220 return true;
221 }
222 }
223 return false;
224 }
225 }
226 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org