@Override public FeatureCalc create(Expression aggregateAttribute) { return new MedianVisitor(aggregateAttribute); }
@Override protected FeatureCalc createVisitor(int attributeTypeIndex, SimpleFeatureType type) { return new MedianVisitor(attributeTypeIndex, type); } }
/** * Calculate median (using FeatureCalc) - only one parameter is used. * * @param collection collection to calculate the median * @param expression Single Expression argument * @return An object containing the median value of the attributes * @throws IllegalFilterException * @throws IOException */ static CalcResult calculateMedian( FeatureCollection<? extends FeatureType, ? extends Feature> collection, Expression expression) throws IllegalFilterException, IOException { MedianVisitor medianVisitor = new MedianVisitor(expression); collection.accepts(medianVisitor, null); return medianVisitor.getResult(); }
calc = new MaxVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Median) { calc = new MedianVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Min) { calc = new MinVisitor(attIndex, features.getSchema());
public void testMedian() throws IllegalFilterException, IOException { MedianVisitor medianVisitor1 = new MedianVisitor(0, ft); MedianVisitor medianVisitor2 = new MedianVisitor(0, ft2);
/** * Calculate median (using FeatureCalc) - only one parameter is used. * * @param collection collection to calculate the median * @param expression Single Expression argument * * @return An object containing the median value of the attributes * * @throws IllegalFilterException * @throws IOException */ static CalcResult calculateMedian(FeatureCollection<? extends FeatureType, ? extends Feature> collection, Expression expression) throws IllegalFilterException, IOException { MedianVisitor medianVisitor = new MedianVisitor(expression); collection.accepts(medianVisitor, null); return medianVisitor.getResult(); }
/** * Calculate median (using FeatureCalc) - only one parameter is used. * * @param collection collection to calculate the median * @param expression Single Expression argument * * @return An object containing the median value of the attributes * * @throws IllegalFilterException * @throws IOException */ public static CalcResult calculateMedian(FeatureCollection collection, Expression expression) throws IllegalFilterException, IOException { MedianVisitor medianVisitor = new MedianVisitor(expression); collection.accepts(medianVisitor, null); return medianVisitor.getResult(); }
calc = new MaxVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Median) { calc = new MedianVisitor(attIndex, features.getSchema()); } else if (function == AggregationFunction.Min) { calc = new MinVisitor(attIndex, features.getSchema());