comparison flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/DateRange.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/DateRange.java@4a70525c5b0d
children
comparison
equal deleted inserted replaced
5830:160f53ee0870 5831:bd047b71ab37
1 package org.dive4elements.river.artifacts.model;
2
3 import java.io.Serializable;
4 import java.util.Date;
5
6 public class DateRange
7 implements Serializable
8 {
9 private static final long serialVersionUID = -2553914795388094818L;
10
11 protected Date from;
12 protected Date to;
13
14 public DateRange(Date from, Date to) {
15 this.from = from;
16 this.to = to;
17 }
18
19 public Date getFrom() {
20 return from;
21 }
22
23 public void setFrom(Date from) {
24 this.from = from;
25 }
26
27 public Date getTo() {
28 return to;
29 }
30
31 public void setTo(Date to) {
32 this.to = to;
33 }
34
35 private static final boolean equalDates(Date a, Date b) {
36 if (a == null && b != null) return false;
37 if (a != null && b == null) return false;
38 if (a == null) return true;
39 return a.equals(b);
40 }
41
42 @Override
43 public boolean equals(Object other) {
44 if (!(other instanceof DateRange)) {
45 return false;
46 }
47 DateRange o = (DateRange)other;
48 return equalDates(from, o.from) && equalDates(to, o.to);
49 }
50 }
51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org