Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/model/DateRange.java @ 9646:0380717105ba
Implemented alternative fitting strategy for Log-Linear function.
author | Gernot Belger <g.belger@bjoernsen.de> |
---|---|
date | Mon, 02 Dec 2019 17:56:15 +0100 |
parents | 091fd9676496 |
children |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.model; import java.io.Serializable; import java.util.Date; import org.dive4elements.artifacts.common.utils.DateUtils; public class DateRange implements Serializable { private static final long serialVersionUID = -2553914795388094818L; private final Date from; private final Date to; public DateRange(final Date from, final Date to) { this.from = from; this.to = to; } public Date getFrom() { return this.from; } public Date getTo() { return this.to; } private static final boolean equalDates(final Date a, final Date b) { if (a == null && b != null) return false; if (a != null && b == null) return false; if (a == null) return true; return a.equals(b); } @Override public boolean equals(final Object other) { if (!(other instanceof DateRange)) return false; final DateRange o = (DateRange) other; return equalDates(this.from, o.from) && equalDates(this.to, o.to); } public int getFromYear() { return DateUtils.getYearFromDate(this.from); } public int getToYear() { return DateUtils.getYearFromDate(this.to); } }