Search in sources :

Example 1 with IdPointValueStatisticsQuantizerJsonCallback

use of com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.IdPointValueStatisticsQuantizerJsonCallback 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);
}
Also used : DataPointVO(com.serotonin.m2m2.vo.DataPointVO) IdPointValueStatisticsQuantizerJsonCallback(com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.IdPointValueStatisticsQuantizerJsonCallback) DataValue(com.serotonin.m2m2.rt.dataImage.types.DataValue) AnalogStatisticsChildQuantizer(com.serotonin.m2m2.web.mvc.rest.v1.statistics.AnalogStatisticsChildQuantizer) BucketCalculator(com.serotonin.m2m2.view.quantize2.BucketCalculator) ParentDataQuantizer(com.serotonin.m2m2.web.mvc.rest.v1.statistics.ParentDataQuantizer) ValueChangeCounterChildQuantizer(com.serotonin.m2m2.web.mvc.rest.v1.statistics.ValueChangeCounterChildQuantizer)

Aggregations

DataValue (com.serotonin.m2m2.rt.dataImage.types.DataValue)1 BucketCalculator (com.serotonin.m2m2.view.quantize2.BucketCalculator)1 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)1 IdPointValueStatisticsQuantizerJsonCallback (com.serotonin.m2m2.web.mvc.rest.v1.model.pointValue.statistics.IdPointValueStatisticsQuantizerJsonCallback)1 AnalogStatisticsChildQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.AnalogStatisticsChildQuantizer)1 ParentDataQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.ParentDataQuantizer)1 ValueChangeCounterChildQuantizer (com.serotonin.m2m2.web.mvc.rest.v1.statistics.ValueChangeCounterChildQuantizer)1