[Schmitzm-commits] r664 - branches/2.0-RC2/src/schmitzm/jfree/feature/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 18:45:17 CET 2010


Author: mojays
Date: 2010-02-03 18:45:14 +0100 (Wed, 03 Feb 2010)
New Revision: 664

Modified:
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
   branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
Log:
New methods to check no data values in FeatureChartStyle.

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-02-03 17:45:14 UTC (rev 664)
@@ -240,8 +240,29 @@
       return dummyFeatureChartStyle.removeNoDataValue(idx, noDataValue);
     }
 
-    
     /**
+     * Checks whether the given value is one of the "No data" values for
+     * the attribute.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     */
+    public boolean isNoDataValue(int idx, Object value) {
+      return dummyFeatureChartStyle.isNoDataValue(idx, value);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for
+     * the attribute. In this case this method returns {@code null}, otherwise
+     * the value itself.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code null} if the given value is one of the "No data" values 
+     */
+    public Object filterNoDataValue(int idx, Object value) {
+      return dummyFeatureChartStyle.filterNoDataValue(idx, value);
+    }
+
+    /**
      * Creates an appropriate {@link Dataset} for the attributes defined
      * by this style (according to the attributes types in the given
      * {@link FeatureCollection}) and calls {@link #applyToDataset(Dataset)}.

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureChartStyle.java	2010-02-03 17:45:14 UTC (rev 664)
@@ -168,8 +168,25 @@
    */
   public boolean removeNoDataValue(int idx, Object noDataValue);
   
+  /**
+   * Checks whether the given value is one of the "No data" values for
+   * the attribute.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   */
+  public boolean isNoDataValue(int idx, Object value);
 
   /**
+   * Checks whether the given value is one of the "No data" values for
+   * the attribute. In this case this method returns {@code null}, otherwise
+   * the value itself.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code null} if the given value is one of the "No data" values 
+   */
+  public Object filterNoDataValue(int idx, Object value);
+
+  /**
    * This class defines a dummy implementation of {@link FeatureChartStyle} just
    * to maintain the properties of the interface {@link FeatureChartStyle}, so
    * sub classes of {@link FeatureChartStyle} which usually are derived from
@@ -467,6 +484,33 @@
         return false;
       return noDataValues.remove(noDataValue);
     }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for
+     * the attribute.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     */
+    public boolean isNoDataValue(int idx, Object value) {
+      Set<Object> noDataValues = getNoDataValues(idx);
+      if ( noDataValues == null )
+        return false;
+      return noDataValues.contains(value);
+    }
+
+    /**
+     * Checks whether the given value is one of the "No data" values for
+     * the attribute. In this case this method returns {@code null}, otherwise
+     * the value itself.
+     * @param idx attribute index the "No Data" value is checked for
+     * @param value an attribute value
+     * @return {@code null} if the given value is one of the "No data" values 
+     */
+    public Object filterNoDataValue(int idx, Object value) {
+      if ( isNoDataValue(idx, value) )
+        return null;
+      return value;
+    }
   }
   
 }

Modified: branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java
===================================================================
--- branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-02-03 17:34:30 UTC (rev 663)
+++ branches/2.0-RC2/src/schmitzm/jfree/feature/style/FeatureScatterChartStyle.java	2010-02-03 17:45:14 UTC (rev 664)
@@ -256,6 +256,28 @@
   }
 
   /**
+   * Checks whether the given value is one of the "No data" values for
+   * the attribute.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   */
+  public boolean isNoDataValue(int idx, Object value) {
+    return dummyFeatureChartStyle.isNoDataValue(idx, value);
+  }
+
+  /**
+   * Checks whether the given value is one of the "No data" values for
+   * the attribute. In this case this method returns {@code null}, otherwise
+   * the value itself.
+   * @param idx attribute index the "No Data" value is checked for
+   * @param value an attribute value
+   * @return {@code null} if the given value is one of the "No data" values 
+   */
+  public Object filterNoDataValue(int idx, Object value) {
+    return dummyFeatureChartStyle.filterNoDataValue(idx, value);
+  }
+
+  /**
    * Creates an appropriate {@link Dataset} for the attributes defined
    * by this style (according to the attributes types in the given
    * {@link FeatureCollection}) and calls {@link #applyToDataset(Dataset)}.



More information about the Schmitzm-commits mailing list