use of com.serotonin.m2m2.web.mvc.rest.v1.statistics.ValueChangeCounterChildQuantizer in project ma-modules-public by infiniteautomation.
the class IdPointValueRollupCalculator method generateStream.
/* (non-Javadoc)
* @see com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.AbstractPointValueRollupCalculator#generateStream(org.joda.time.DateTime, org.joda.time.DateTime, com.serotonin.m2m2.web.mvc.rest.v1.csv.CSVPojoWriter)
*/
@Override
protected void generateStream(DateTime from, DateTime to, CSVPojoWriter<PointValueTimeModel> writer) {
BucketCalculator bc = this.getBucketCalculator(from, to);
IdPointValueStatisticsQuantizerCsvCallback callback = new IdPointValueStatisticsQuantizerCsvCallback(writer.getWriter(), this.voMap, this.useRendered, this.unitConversion, this.rollup, this.dateTimeFormat, timezone);
Iterator<Integer> it = this.voMap.keySet().iterator();
ParentDataQuantizer quantizer = new ParentDataQuantizer(bc, callback);
while (it.hasNext()) {
DataPointVO vo = this.voMap.get(it.next());
DataValue startValue = this.getStartValue(vo.getId());
if (vo.getPointLocator().getDataTypeId() == DataTypes.NUMERIC) {
quantizer.startQuantizer(vo.getId(), startValue, new AnalogStatisticsChildQuantizer(vo.getId(), quantizer));
} else {
quantizer.startQuantizer(vo.getId(), startValue, new ValueChangeCounterChildQuantizer(vo.getId(), quantizer));
}
}
this.calculate(quantizer, from, to);
}
use of com.serotonin.m2m2.web.mvc.rest.v1.statistics.ValueChangeCounterChildQuantizer in project ma-modules-public by infiniteautomation.
the class IdPointValueRollupCalculator method generateStream.
/* (non-Javadoc)
* @see com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.AbstractPointValueRollupCalculator#generateStream(org.joda.time.DateTime, org.joda.time.DateTime, com.fasterxml.jackson.core.JsonGenerator)
*/
@Override
protected void generateStream(DateTime from, DateTime to, JsonGenerator jgen) {
BucketCalculator bc = this.getBucketCalculator(from, to);
IdPointValueStatisticsQuantizerJsonCallback callback = new IdPointValueStatisticsQuantizerJsonCallback(jgen, this.voMap, this.useRendered, this.unitConversion, this.rollup, this.limit, this.dateTimeFormat, timezone);
Iterator<Integer> it = this.voMap.keySet().iterator();
ParentDataQuantizer quantizer = new ParentDataQuantizer(bc, callback);
while (it.hasNext()) {
DataPointVO vo = this.voMap.get(it.next());
DataValue startValue = this.getStartValue(vo.getId());
if (vo.getPointLocator().getDataTypeId() == DataTypes.NUMERIC) {
quantizer.startQuantizer(vo.getId(), startValue, new AnalogStatisticsChildQuantizer(vo.getId(), quantizer));
} else {
quantizer.startQuantizer(vo.getId(), startValue, new ValueChangeCounterChildQuantizer(vo.getId(), quantizer));
}
}
this.calculate(quantizer, from, to);
}
Aggregations