1 | package de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.strategies; |
2 | |
3 | import javax.measure.Measure; |
4 | import javax.measure.quantity.Duration; |
5 | import javax.measure.unit.SI; |
6 | |
7 | import de.uka.ipd.sdq.pipesandfilters.framework.PipeData; |
8 | import de.uka.ipd.sdq.sensorframework.entities.Experiment; |
9 | import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun; |
10 | import de.uka.ipd.sdq.sensorframework.entities.Sensor; |
11 | import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor; |
12 | import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory; |
13 | |
14 | public class WaitingTimeWriteDataStrategy extends AbstractWriteDataStrategy { |
15 | |
16 | public WaitingTimeWriteDataStrategy(IDAOFactory daoFactory, |
17 | Experiment experiment, ExperimentRun run) { |
18 | super(daoFactory, experiment, run); |
19 | } |
20 | |
21 | @SuppressWarnings("unchecked") |
22 | @Override |
23 | public void writeData(PipeData data) { |
24 | Measure<Double, Duration> timeSpanMeasure = (Measure<Double, Duration>) data |
25 | .getTupleElement(0); |
26 | double timeSpan = timeSpanMeasure.doubleValue(SI.SECOND); |
27 | Measure<Double, Duration> eventTimeMeasure = (Measure<Double, Duration>) data |
28 | .getTupleElement(1); |
29 | double eventTime = eventTimeMeasure.doubleValue(SI.SECOND); |
30 | run.addTimeSpanMeasurement((TimeSpanSensor)sensor, eventTime, timeSpan); |
31 | } |
32 | |
33 | } |