Class PercentileAggregationFunction

java.lang.Object
nz.org.riskscape.engine.rl.agg.ListCollecting
nz.org.riskscape.engine.rl.agg.PercentileAggregationFunction
All Implemented Interfaces:
nz.org.riskscape.engine.rl.agg.AggregationFunction
Direct Known Subclasses:
PercentileAggregationFunction.Single, PercentileAggregationFunction.SingleFixed

public class PercentileAggregationFunction extends ListCollecting

Calculates percentiles using the nearest-rank method.

  • Field Details

    • PERCENTILE_TYPE

      public static final nz.org.riskscape.engine.types.Type PERCENTILE_TYPE
    • PERCENTILES_TYPE

      public static final nz.org.riskscape.engine.types.RSList PERCENTILES_TYPE
  • Constructor Details

    • PercentileAggregationFunction

      public PercentileAggregationFunction()
  • Method Details

    • buildProcessor

      protected ListCollecting.ListProcessor buildProcessor(nz.org.riskscape.engine.types.RSList listType, nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.rl.ast.FunctionCall fc) throws nz.org.riskscape.problem.ProblemException
      Description copied from class: ListCollecting

      Build a ListCollecting.ListProcessor that can produce the aggregated result.

      Specified by:
      buildProcessor in class ListCollecting
      Parameters:
      listType - type of the list that will be passed to built processor
      context - context to realize any other expressions with
      Returns:
      list processor to capable of producing aggregated result
      Throws:
      nz.org.riskscape.problem.ProblemException - with any problems encountered
    • getPercentiles

      protected List<Long> getPercentiles(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall fc) throws nz.org.riskscape.problem.ProblemException
      Returns:
      list of percentiles that need to be found.
      Throws:
      nz.org.riskscape.problem.ProblemException
    • buildResult

      protected Object buildResult(Object[] results, nz.org.riskscape.engine.types.Type resultType)
    • getResultTypeFor

      protected nz.org.riskscape.engine.types.Type getResultTypeFor(nz.org.riskscape.engine.types.Type internalType, List<Long> percentiles) throws nz.org.riskscape.problem.ProblemException
      Throws:
      nz.org.riskscape.problem.ProblemException