diff gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixingsOverviewInfo.java @ 9099:850ce16034e9

2.3.4.1.10 Berechnung mit Start-km > End-km
author gernotbelger
date Mon, 28 May 2018 13:22:45 +0200
parents 0f3dad5d74a2
children 2a1dcee5e54a
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixingsOverviewInfo.java	Mon May 28 10:56:57 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixingsOverviewInfo.java	Mon May 28 13:22:45 2018 +0200
@@ -9,9 +9,8 @@
 package org.dive4elements.river.client.shared.model;
 
 import java.io.Serializable;
-
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
 
 public class FixingsOverviewInfo implements Serializable {
 
@@ -22,16 +21,10 @@
     protected int rid;
     protected String html;
 
-    protected FixingsOverviewInfo() {}
+    private FixingsOverviewInfo() {
+    }
 
-    public FixingsOverviewInfo(
-        int rid,
-        String river,
-        double from,
-        double to,
-        List<FixEvent> events,
-        String html
-    ) {
+    public FixingsOverviewInfo(final int rid, final String river, final double from, final double to, final List<FixEvent> events, final String html) {
         this.rid = rid;
         this.river = river;
         this.from = from;
@@ -48,20 +41,29 @@
         return this.river;
     }
 
-    public double getFrom() {
-        return this.from;
+    public double getLowerKm() {
+        return Math.min(this.from, this.to);
     }
 
-    public double getTo() {
-        return this.to;
+    public double getUpperKm() {
+        return Math.max(this.from, this.to);
     }
 
+    // public double getFrom() {
+    // return this.from < this.to ? this.from : this.to; // TODO: prüfung wieder rausnehmen, hat glaube ich keinen
+    // sinnvollen effekt.
+    // }
+    //
+    // public double getTo() {
+    // return this.to > this.from ? this.to : this.from;
+    // }
+
     public List<FixEvent> getEvents() {
         return this.events;
     }
 
-    public FixEvent getEventByCId(String cid) {
-        for (FixEvent event: events) {
+    public FixEvent getEventByCId(final String cid) {
+        for (final FixEvent event : this.events) {
             if (event.getCId().equals(cid)) {
                 return event;
             }
@@ -73,21 +75,16 @@
         return this.html;
     }
 
-
     public static class FixEvent implements Serializable {
         protected String cid;
         protected String date;
         protected String description;
         protected List<Sector> sectors;
 
-        protected FixEvent () {}
+        protected FixEvent() {
+        }
 
-        public FixEvent(
-            String cid,
-            String date,
-            String description,
-            List<Sector> sectors
-        ) {
+        public FixEvent(final String cid, final String date, final String description, final List<Sector> sectors) {
             this.cid = cid;
             this.date = date;
             this.description = description;
@@ -116,13 +113,10 @@
         protected double from;
         protected double to;
 
-        protected Sector () {}
+        protected Sector() {
+        }
 
-        public Sector(
-            int cls,
-            double from,
-            double to
-        ) {
+        public Sector(final int cls, final double from, final double to) {
             this.cls = cls;
             this.from = from;
             this.to = to;

http://dive4elements.wald.intevation.org