teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5861: * Software engineering by Intevation GmbH teichmann@5861: * teichmann@5993: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5993: * documentation coming with Dive4Elements River for details. teichmann@5861: */ teichmann@5861: teichmann@5835: package org.dive4elements.river.client.shared.model; raimund@2505: raimund@2505: import java.io.Serializable; gernotbelger@9099: import java.util.ArrayList; raimund@2505: import java.util.List; raimund@2505: raimund@2505: public class FixingsOverviewInfo implements Serializable { raimund@2505: raimund@2505: protected List events; raimund@2505: protected String river; raimund@2505: protected double from; raimund@2505: protected double to; raimund@2505: protected int rid; raimund@2505: protected String html; raimund@2505: gernotbelger@9099: private FixingsOverviewInfo() { gernotbelger@9099: } raimund@2505: gernotbelger@9099: public FixingsOverviewInfo(final int rid, final String river, final double from, final double to, final List events, final String html) { raimund@2505: this.rid = rid; raimund@2505: this.river = river; raimund@2505: this.from = from; raimund@2505: this.to = to; raimund@2505: this.events = new ArrayList(events); raimund@2505: this.html = html; raimund@2505: } raimund@2505: raimund@2505: public int getRId() { raimund@2505: return this.rid; raimund@2505: } raimund@2505: raimund@2505: public String getRiver() { raimund@2505: return this.river; raimund@2505: } raimund@2505: gernotbelger@9099: public double getLowerKm() { gernotbelger@9099: return Math.min(this.from, this.to); raimund@2505: } raimund@2505: gernotbelger@9099: public double getUpperKm() { gernotbelger@9099: return Math.max(this.from, this.to); raimund@2505: } raimund@2505: gernotbelger@9099: // public double getFrom() { gernotbelger@9099: // return this.from < this.to ? this.from : this.to; // TODO: prüfung wieder rausnehmen, hat glaube ich keinen gernotbelger@9099: // sinnvollen effekt. gernotbelger@9099: // } gernotbelger@9099: // gernotbelger@9099: // public double getTo() { gernotbelger@9099: // return this.to > this.from ? this.to : this.from; gernotbelger@9099: // } gernotbelger@9099: raimund@2505: public List getEvents() { raimund@2505: return this.events; raimund@2505: } raimund@2505: gernotbelger@9099: public FixEvent getEventByCId(final String cid) { gernotbelger@9099: for (final FixEvent event : this.events) { teichmann@6867: if (event.getCId().equals(cid)) { teichmann@6867: return event; raimund@2505: } raimund@2505: } raimund@2505: return null; raimund@2505: } raimund@2505: raimund@2505: public String getHTML() { raimund@2505: return this.html; raimund@2505: } raimund@2505: raimund@2505: public static class FixEvent implements Serializable { raimund@2505: protected String cid; raimund@2505: protected String date; raimund@2536: protected String description; raimund@2505: protected List sectors; raimund@2505: gernotbelger@9099: protected FixEvent() { gernotbelger@9099: } raimund@2505: gernotbelger@9099: public FixEvent(final String cid, final String date, final String description, final List sectors) { raimund@2505: this.cid = cid; raimund@2505: this.date = date; raimund@2536: this.description = description; raimund@2505: this.sectors = new ArrayList(sectors); raimund@2505: } raimund@2505: raimund@2505: public String getCId() { raimund@2505: return this.cid; raimund@2505: } raimund@2505: raimund@2505: public String getDate() { raimund@2505: return this.date; raimund@2505: } raimund@2505: raimund@2536: public String getDescription() { raimund@2536: return this.description; raimund@2505: } raimund@2505: raimund@2505: public List getSectors() { raimund@2505: return this.sectors; raimund@2505: } raimund@2505: } raimund@2505: raimund@2505: public static class Sector implements Serializable { raimund@2505: protected int cls; raimund@2505: protected double from; raimund@2505: protected double to; raimund@2505: gernotbelger@9099: protected Sector() { gernotbelger@9099: } raimund@2505: gernotbelger@9099: public Sector(final int cls, final double from, final double to) { raimund@2505: this.cls = cls; raimund@2505: this.from = from; raimund@2505: this.to = to; raimund@2505: } raimund@2505: raimund@2505: public int getCls() { raimund@2505: return this.cls; raimund@2505: } raimund@2505: raimund@2505: public double getFrom() { raimund@2505: return this.from; raimund@2505: } raimund@2505: raimund@2505: public double getTo() { raimund@2505: return this.to; raimund@2505: } raimund@2505: } raimund@2505: } raimund@2505: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :