Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/Timerange.java @ 6678:0a70a320bfca
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 29 Jul 2013 09:22:11 +0200 |
parents | af13ceeba52a |
children |
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:
5914
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:
5914
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:
2227
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
2217
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 import java.io.Serializable; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
2227
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
13 import java.util.Date; |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
14 |
2217
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 /** |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * This class represents time ranges specified by start and end time. Start and |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * end times are stored as long (number of milliseconds since january 1, 1970). |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @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
|
21 */ |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class Timerange implements Serializable { |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 private long start; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 private long end; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 public Timerange(long start, long end) { |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 this.start = start; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 this.end = end; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 } |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
2227
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
34 public Timerange(Date start, Date stop) { |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
35 this.start = start.getTime(); |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
36 this.end = stop != null ? stop.getTime() : System.currentTimeMillis(); |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
37 } |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
38 |
2e6f0ef36352
Added a new constructor to Timerange that takes Date objects for start and end.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2217
diff
changeset
|
39 |
2217
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public long getStart() { |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 return start; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 } |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 public long getEnd() { |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 return end; |
54422e31dc27
Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
5914
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
48 |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
49 public void sort() { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
50 if (start > end) { |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
51 long t = start; start = end; end = t; |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
52 } |
1058b3436dad
D4E river artifacts: Removed historical discharge calculation from WINFO artifact and use access instead.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
53 } |
2217
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |