E - type of ExpressionTargetpublic class ReductionHandler<E extends uk.ac.ed.epcc.webapp.model.data.DataObject & ExpressionTarget,F extends uk.ac.ed.epcc.webapp.model.data.DataObjectFactory<E> & ExpressionTargetFactory<E>> extends java.lang.Object implements ReductionProducer<E>
ExpressionTargetFactory that implements ReductionProducer| Constructor and Description |
|---|
ReductionHandler(AccessorMap map,
F fac) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
compatible(RecordSelector sel) |
java.util.Map<ExpressionTuple,ReductionMapResult> |
getIndexedReductionMap(java.util.Set<ReductionTarget> sum,
RecordSelector selector)
General reduction operation.
|
<R> R |
getReduction(ReductionTarget<R> type,
RecordSelector sel)
Perform a reduction over a set of records
|
<I> java.util.Map<I,java.lang.Number> |
getReductionMap(PropExpression<I> index,
ReductionTarget<java.lang.Number> property,
RecordSelector selector)
sum the specified numerical quantity over all records that match the selector
grouped by the other specified property
|
public ReductionHandler(AccessorMap map, F fac)
public final boolean compatible(RecordSelector sel)
public java.util.Map<ExpressionTuple,ReductionMapResult> getIndexedReductionMap(java.util.Set<ReductionTarget> sum, RecordSelector selector) throws java.lang.Exception
ReductionProducerReductionTarget objects. This method generates
Maps from the requested ReductionTarget to the result of the corresponding reduction.
If the list of ReductionTargets contains any IndexReduction objects then multiple results will
be returned so these results are themselves returned as a Map indexed by PropertyTuple objects
representing the Index values. If there are no IndexValues an empty PropertyTuple will be used.
A non-index target that does not resolve may be ignored or return the default value for
the ReductionTarget. This is so target set compatible with composite UsageProducers
can contain targets only relevant to some of its parts without suppressing all output from the
tables that don't support the property. This does run the risk that spurious index-tuples
might be generated from tables that support none of the non-index targets.
In that case the producer has to be tuned.getIndexedReductionMap in interface ReductionProducer<E extends uk.ac.ed.epcc.webapp.model.data.DataObject & ExpressionTarget>java.lang.Exceptionpublic <R> R getReduction(ReductionTarget<R> type, RecordSelector sel) throws java.lang.Exception
ReductionProducergetReduction in interface ReductionProducer<E extends uk.ac.ed.epcc.webapp.model.data.DataObject & ExpressionTarget>java.lang.Exceptiontype - ReductionTarget specifying reduction to performsel - RecordSelector to select target recordspublic <I> java.util.Map<I,java.lang.Number> getReductionMap(PropExpression<I> index, ReductionTarget<java.lang.Number> property, RecordSelector selector) throws java.lang.Exception
ReductionProducergetReductionMap in interface ReductionProducer<E extends uk.ac.ed.epcc.webapp.model.data.DataObject & ExpressionTarget>java.lang.Exception