use of com.infiniteautomation.mango.statistics.NoStatisticsGenerator in project ma-modules-public by infiniteautomation.
the class MultiDataPointDefaultRollupStatisticsQuantizerStream method process.
/**
* Process the data into lists per data point, simplify if necessary
*/
private Map<DataPointVO, List<DataPointValueTime>> process(Integer limit) {
Map<DataPointVO, List<DataPointValueTime>> processed = new LinkedHashMap<>();
for (DataPointVO vo : voMap.values()) {
List<DataPointStatisticsGenerator> generators = valueMap.get(vo.getId());
List<DataPointValueTime> values = new ArrayList<>();
if (generators.get(0).getGenerator() instanceof NoStatisticsGenerator) {
// Iterate and combine into an array
for (DataPointStatisticsGenerator gen : generators) {
NoStatisticsGenerator noGen = (NoStatisticsGenerator) gen.getGenerator();
for (IValueTime value : noGen.getValues()) {
values.add(new DataPointVOPointValueTimeBookend(vo, (IdPointValueTime) value));
}
}
} else {
for (DataPointStatisticsGenerator generator : generators) {
values.add(new DataPointRollupPeriodValue(generator, RollupEnum.convertTo(vo.getRollup())));
}
}
if (values.size() > 0) {
// As the other endpoints, limit before simplification
if (limit != null)
values = values.subList(0, limit);
if (vo.isSimplifyDataSets()) {
if (vo.getSimplifyType() == DataPointVO.SimplifyTypes.TARGET)
values = SimplifyUtility.simplify(null, vo.getSimplifyTarget(), true, true, values);
else
values = SimplifyUtility.simplify(vo.getSimplifyTolerance(), null, true, true, values);
}
processed.put(vo, values);
}
}
return processed;
}
Aggregations