Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/model/DateRange.java @ 9425:3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 15:31:02 +0200 |
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); } }