@Test public void testCountVisitorDelegation() throws SchemaException, IOException { FeatureVisitor visitor = new CountVisitor(); assertOptimalVisit(visitor); }
@Override public FeatureCalc create(Expression aggregateAttribute) { return new CountVisitor(); }
/** Returns the count of the features for a particular feature type / table. */ protected int getCount(SimpleFeatureType featureType, Query query, Connection cx) throws IOException { CountVisitor v = new CountVisitor(); getAggregateValue(v, featureType, query, cx); return v.getCount(); }
/** * Calculate count (using FeatureCalc) - only one parameter is used. * * @param collection collection to calculate the count * @return An object containing the count value of the attributes * @throws IllegalFilterException * @throws IOException */ static CalcResult calculateCount(SimpleFeatureCollection collection) throws IllegalFilterException, IOException { CountVisitor countVisitor = new CountVisitor(); collection.accepts(countVisitor, null); return countVisitor.getResult(); }
public void testCountVisitorDelegation() throws Exception { FeatureVisitor visitor = new CountVisitor(); assertOptimalVisit(visitor); }
public void testCountVisitorDelegation() throws SchemaException, IOException { FeatureVisitor visitor = new CountVisitor(); assertOptimalVisit(visitor); }
@Test public void testCountVisitorDelegation() throws SchemaException, IOException { FeatureVisitor visitor = new CountVisitor(); assertOptimalVisit(visitor); }
calc = new AverageVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Count) { calc = new CountVisitor(); } else if (function == AggregationFunction.Max) { calc = new MaxVisitor(attIndex, features.getSchema());
public void testBadMerge() throws IllegalFilterException, IOException { // count + max = boom! CountVisitor countVisitor = new CountVisitor(); countVisitor.setValue(8); CalcResult countResult = countVisitor.getResult(); MaxVisitor maxVisitor = new MaxVisitor((Expression) null); maxVisitor.setValue(new Double(99)); CalcResult maxResult = maxVisitor.getResult(); try { CalcResult boomResult = maxResult.merge(countResult); fail(); // merge should throw an exception } catch (Exception e) { assertEquals("Parameter is not a compatible type", e.getMessage()); } }
/** * Returns the count of the features for a particular feature type / table. */ protected int getCount(SimpleFeatureType featureType, Query query, Connection cx) throws IOException { CountVisitor v = new CountVisitor(); getAggregateValue(v,featureType,query,cx); return v.getCount(); }
public void testCountSumMerge() throws IllegalFilterException, IOException { CountVisitor countVisitor = new CountVisitor(); fc2.accepts(countVisitor, null); // count = 2 SumVisitor sumVisitor = new SumVisitor(3, ft2); fc2.accepts(sumVisitor, null); // sum = 7.5 CalcResult countResult = countVisitor.getResult(); CalcResult sumResult = sumVisitor.getResult(); CalcResult averageResult1 = countResult.merge(sumResult); CalcResult averageResult2 = sumResult.merge(countResult); // both average results were correct? assertEquals((double) 3.75, averageResult1.toDouble(), 0); assertEquals((double) 3.75, averageResult2.toDouble(), 0); // neither sum nor count was destroyed? assertEquals(2, countResult.toInt()); assertEquals((double) 7.5, sumResult.toDouble(), 0); }
/** * Calculate count (using FeatureCalc) - only one parameter is used. * * @param collection * collection to calculate the count * * @return An object containing the count value of the attributes * * @throws IllegalFilterException * @throws IOException */ static CalcResult calculateCount(SimpleFeatureCollection collection) throws IllegalFilterException, IOException { CountVisitor countVisitor = new CountVisitor(); collection.accepts(countVisitor, null); return countVisitor.getResult(); }
/** * Calculate count (using FeatureCalc) - only one parameter is used. * * @param collection * collection to calculate the count * * @return An object containing the count value of the attributes * * @throws IllegalFilterException * @throws IOException */ public static CalcResult calculateCount(FeatureCollection collection) throws IllegalFilterException, IOException { CountVisitor countVisitor = new CountVisitor(); collection.accepts(countVisitor, null); return countVisitor.getResult(); }
public void testCount() throws IllegalFilterException, IOException { CountVisitor countVisitor = new CountVisitor(); fc.accepts(countVisitor, null); CountVisitor countVisitor2 = new CountVisitor(); fc2.accepts(countVisitor2, null);
@Test public void testCountVisitorDelegation() { FeatureVisitor visitor = new CountVisitor(); assertOptimalVisit(visitor, countVisitorCollections); }
@Test public void testCountVisitorDelegation() throws SchemaException, IOException { FeatureVisitor visitor = new CountVisitor(); WrapperPolicy policy = WrapperPolicy.hide( new VectorAccessLimits(CatalogMode.HIDE, null, null, null, null)); assertOptimalVisit(visitor, policy); }
calc = new AverageVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Count) { calc = new CountVisitor(); } else if (function == AggregationFunction.Max) { calc = new MaxVisitor(attIndex, features.getSchema());