Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java @ 3762:0c978a80726a
Splitted up facets for porosity and density into two facets: a toplayer and a sublayer facet for each. BedQualityState will now create facets based on the calculation result.
flys-artifacts/trunk@5464 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 14 Sep 2012 07:12:08 +0000 |
parents | 312870fded7e |
children | 00aafe1fedd7 |
line wrap: on
line source
package de.intevation.flys.artifacts.access; import java.util.Date; import java.util.LinkedList; import java.util.List; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.DateRange; public class BedQualityAccess extends Access { private Double from; private Double to; private String river; private List<DateRange> ranges; public BedQualityAccess(FLYSArtifact artifact) { super(artifact); } public double getFrom() { if (from == null) { from = getDouble("ld_from"); } return from.doubleValue(); } public double getTo() { if (to == null) { to = getDouble("ld_to"); } return to.doubleValue(); } public String getRiver() { if (river == null) { river = getString("river"); } return river; } public List<DateRange> getDateRanges() { if (ranges == null) { ranges = extractRanges(getString("periods")); } return ranges; } private List<DateRange> extractRanges(String dateString) { List<DateRange> list = new LinkedList<DateRange>(); String[] dates = dateString.split(";"); for (String s : dates) { String[] pair = s.split(","); try { long l1 = Long.parseLong(pair[0]); long l2 = Long.parseLong(pair[1]); Date first = new Date(l1); Date second = new Date(l2); DateRange dr = new DateRange(first, second); list.add(dr); } catch (NumberFormatException nfe) { continue; } } return list; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :