annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WQTimerange.java @ 4699:756aba0d2a7a

Removed unneeded imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 17 Dec 2012 17:57:32 +0100
parents 1d8faeedda0c
children 05eeedc5b156
rev   line source
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
4171
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
4 import java.util.Collections;
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.List;
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 /**
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 */
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 public class WQTimerange extends WQ {
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
4171
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
13 public static class TimerangeItem implements Comparable<TimerangeItem> {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
14 public double q;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
15 public double w;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
16 public Timerange timerange;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
17
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
18 public TimerangeItem (Timerange timerange, double q, double w) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
19 this.timerange = timerange;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
20 this.q = q;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
21 this.w = w;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
22 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
23
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
24 public double[] get(double[] wq) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
25 if (wq.length >= 2) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
26 wq[0] = w;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
27 wq[1] = q;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
28 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
29
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
30 return wq;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
31 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
32
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
33 @Override
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
34 public int compareTo(TimerangeItem other) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
35 if (other.timerange.getStart() < timerange.getStart()) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
36 return 1;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
37 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
38 else if (other.timerange.getStart() > timerange.getStart()) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
39 return -1;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
40 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
41 else if (other.timerange.getEnd() < timerange.getEnd()) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
42 return 1;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
43 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
44 else if (other.timerange.getEnd() > timerange.getEnd()){
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
45 return -1;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
46 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
47 else {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
48 return 0;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
49 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
50 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
51 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
52
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 protected List<Timerange> ts;
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 public WQTimerange() {
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 super("");
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 public WQTimerange(String name) {
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 super(name);
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 ts = new ArrayList<Timerange>();
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 public void add(double w, double q, Timerange t) {
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 ws.add(w);
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 qs.add(q);
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 ts.add(t);
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
2239
e7843533f086 Improved WQTimerange and HistoricalDischargeFacet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2217
diff changeset
74 public Timerange getTimerange(int idx) {
e7843533f086 Improved WQTimerange and HistoricalDischargeFacet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2217
diff changeset
75 return ts.get(idx);
e7843533f086 Improved WQTimerange and HistoricalDischargeFacet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2217
diff changeset
76 }
e7843533f086 Improved WQTimerange and HistoricalDischargeFacet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2217
diff changeset
77
e7843533f086 Improved WQTimerange and HistoricalDischargeFacet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2217
diff changeset
78
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 public Timerange[] getTimeranges() {
3452
200e70f31f6f Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2311
diff changeset
80 return ts.toArray(new Timerange[ts.size()]);
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 }
4171
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
82
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
83 public List<TimerangeItem> sort() {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
84 ArrayList<TimerangeItem> items = new ArrayList<TimerangeItem>(ts.size());
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
85 for (int i = 0, n = size(); i < n; i++) {
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
86 items.add(new TimerangeItem(getTimerange(i), getQ(i), getW(i)));
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
87 }
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
88
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
89 Collections.sort(items);
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
90 return items;
1d8faeedda0c Sort calculation results of a historical discharge calculation based on their start date.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3452
diff changeset
91 }
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org