Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixRealizingCalculationExtended.java @ 9348:a3f318347707
Show wq outliers within same thems with different symbol: not ready yet
author | gernotbelger |
---|---|
date | Tue, 31 Jul 2018 11:25:38 +0200 |
parents | 7565d7dce850 |
children | 9744ce3c3853 |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * 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.fixings; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import org.dive4elements.river.artifacts.access.FixRealizingAccess; import org.dive4elements.river.artifacts.model.FixingsOverview; import org.dive4elements.river.artifacts.model.FixingsOverviewFactory; /** * REMARK: this inheritance is only needed, beause changing the orignal calculation will probably break the * serialization of the artifact.... * * @author Gernot Belger */ public class FixRealizingCalculationExtended extends FixRealizingCalculation { private static final long serialVersionUID = 1L; public FixRealizingCalculationExtended(final FixRealizingAccess fixAccess) { super(fixAccess); } public int determineMeanYear() { final FixingsOverview overview = FixingsOverviewFactory.getOverview(this.river); final ColumnCache cc = new ColumnCache(); final SortedSet<Integer> years = new TreeSet<>(); final Calendar cal = Calendar.getInstance(); final List<Column> columns = getEventColumns(overview, cc); for (final Column column : columns) { final Date date = column.getDate(); cal.setTime(date); final int year = cal.get(Calendar.YEAR); years.add(year); } final Integer first = years.first(); final Integer last = years.last(); if (first == null || last == null) return -1; return (first + last) / 2; } }