annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Timerange.java @ 4771:e21acb4f5c62

Simplified code.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 05 Jan 2013 12:13:16 +0100
parents 2e6f0ef36352
children
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.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
4
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
5 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
6
2217
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 * 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
10 * 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
11 *
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 * @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
13 */
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 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
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 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
17 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
18
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 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
21 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
22 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
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
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
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
26 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
27 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
28 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
29 }
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
30
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
31
2217
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 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
33 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
34 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 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
38 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
39 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 }
54422e31dc27 Added new model classes which will be used during historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org