Search in sources :

Example 1 with DoubleTimeSeriesProcessor

use of eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor in project selenium_java by sergueik.

the class CsvFileAdapter method fetchDecodedData.

@Override
public Map<TimeSeriesInfo<Double>, TimeSeriesProcessor<Double>> fetchDecodedData(String path, Instant begin, Instant end, List<TimeSeriesInfo<Double>> seriesInfo, boolean bypassCache) throws DataAdapterException {
    if (this.isClosed()) {
        throw new IllegalStateException("An attempt was made to fetch data from a closed adapter");
    }
    Map<TimeSeriesInfo<Double>, TimeSeriesProcessor<Double>> series = new HashMap<>();
    Map<String, TimeSeriesInfo<Double>> rDict = new HashMap<>();
    for (TimeSeriesInfo<Double> info : seriesInfo) {
        rDict.put(info.getBinding().getLabel(), info);
        series.put(info, new DoubleTimeSeriesProcessor());
    }
    for (DataSample<Double> sample : getDataStore().subMap(begin.getEpochSecond(), end.getEpochSecond()).values()) {
        for (String n : sample.getCells().keySet()) {
            TimeSeriesInfo<Double> i = rDict.get(n);
            if (i != null) {
                series.get(i).addSample(new XYChart.Data<>(sample.getTimeStamp(), sample.getCells().get(n)));
            }
        }
    }
    return series;
}
Also used : TimeSeriesInfo(eu.fthevenet.binjr.data.workspace.TimeSeriesInfo) HashMap(java.util.HashMap) TimeSeriesProcessor(eu.fthevenet.binjr.data.timeseries.TimeSeriesProcessor) DoubleTimeSeriesProcessor(eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor) XYChart(javafx.scene.chart.XYChart) DoubleTimeSeriesProcessor(eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor)

Aggregations

DoubleTimeSeriesProcessor (eu.fthevenet.binjr.data.timeseries.DoubleTimeSeriesProcessor)1 TimeSeriesProcessor (eu.fthevenet.binjr.data.timeseries.TimeSeriesProcessor)1 TimeSeriesInfo (eu.fthevenet.binjr.data.workspace.TimeSeriesInfo)1 HashMap (java.util.HashMap)1 XYChart (javafx.scene.chart.XYChart)1