diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java @ 9415:9744ce3c3853

Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets. The facets also put the valid station range into their xml-metadata
author gernotbelger
date Thu, 16 Aug 2018 16:27:53 +0200
parents 5e38e2924c07
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Aug 16 15:47:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsFacet.java	Thu Aug 16 16:27:53 2018 +0200
@@ -8,35 +8,27 @@
 
 package org.dive4elements.river.artifacts.model.fixings;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
+
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
-import static org.dive4elements.river.exports.injector.InjectorConstants.CURRENT_KM;
 /**
  * Facet to access the current Km from the context safely
  *
  * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
  */
-public class FixingsFacet extends DataFacet {
+public abstract class FixingsFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
 
     public static final Double INVALID_KM = Double.valueOf(-1d);
 
     public FixingsFacet() {
     }
 
-    public  FixingsFacet(String name, String description) {
-        super(0, name, description, ComputeType.ADVANCE, null, null);
-    }
-
-    public FixingsFacet(
-            int         index,
-            String      name,
-            String      description,
-            ComputeType type,
-            String      hash,
-            String      stateId
-            ) {
+    public FixingsFacet(final int index, final String name, final String description, final ComputeType type, final String hash, final String stateId) {
         super(index, name, description, type, hash, stateId);
     }
 
@@ -44,17 +36,19 @@
      * Returns the current km from the context.
      * If the context is null or doesn't contain a currentKm
      * then a double value of -1 will be returned.
-     * @param context The CallContext instance
+     *
+     * @param context
+     *            The CallContext instance
      * @return the current km as double
      */
-    protected double getCurrentKm(CallContext context) {
+    protected final double getCurrentKm(final CallContext context) {
         if (context == null) {
             return INVALID_KM;
         }
-        Double dkm = (Double)context.getContextValue(CURRENT_KM);
+        final Double dkm = (Double) context.getContextValue(CURRENT_KM);
         if (dkm == null) {
             return INVALID_KM;
         }
         return dkm.doubleValue();
     }
-}
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org