public void xtestNullNaNHandling() throws Exception { // create a feature collection SimpleFeatureType ft = DataUtilities.createType("classification.nullnan", "id:0,foo:int,bar:double"); Integer iVal[] = new Integer[] { new Integer(0), new Integer(0), new Integer(0), new Integer(13), new Integer(13), new Integer(13), null, null, null }; Double dVal[] = new Double[] { new Double(0.0), new Double(50.01), null, new Double(0.0), new Double(50.01), null, new Double(0.0), new Double(50.01), null }; SimpleFeature[] testFeatures = new SimpleFeature[iVal.length]; for (int i = 0; i < iVal.length; i++) { testFeatures[i] = SimpleFeatureBuilder.build( ft, new Object[] { new Integer(i + 1), iVal[i], dVal[i], }, "nantest.t" + (i + 1)); } MemoryDataStore store = new MemoryDataStore(); store.createSchema(ft); store.addFeatures(testFeatures); FeatureCollection<SimpleFeatureType, SimpleFeature> thisFC = store.getFeatureSource("nullnan").getFeatures(); // create the expression Divide divide = ff.divide(ff.property("foo"), ff.property("bar")); QuantileFunction qf = (QuantileFunction) ff.function("Quantile", divide, ff.literal(3)); RangedClassifier range = (RangedClassifier) qf.evaluate(thisFC); assertEquals(2, range.getSize()); // 2 or 3? assertEquals("0..0", range.getTitle(0)); assertEquals("0..0.25995", range.getTitle(1)); }
public void testSetParameters() throws Exception { Literal classes = ff.literal(3); PropertyName expr = ff.property("foo"); QuantileFunction func = (QuantileFunction) ff.function("Quantile", expr, classes); assertEquals(3, func.getClasses()); classes = ff.literal(12); func = (QuantileFunction) ff.function("Quantile", expr, classes); assertEquals(12, func.getClasses()); // deprecated still works? classes = ff.literal(5); func = (QuantileFunction) ff.function("Quantile", expr, classes); assertEquals(5, func.getClasses()); }