1 | package de.uka.ipd.sdq.sensorframework.adapter; |
2 | |
3 | import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.Histogram; |
4 | import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements; |
5 | import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor; |
6 | |
7 | public class TimeSpanSensorToHistogramFactory implements IAdapterFactory { |
8 | |
9 | public boolean canAdapt(Object adaptee, Class<?> targetClass) { |
10 | if (adaptee instanceof SensorAndMeasurements){ |
11 | SensorAndMeasurements sam = (SensorAndMeasurements) adaptee; |
12 | if (sam.getSensor() instanceof TimeSpanSensor && Histogram.class == targetClass) |
13 | return true; |
14 | } |
15 | return false; |
16 | } |
17 | |
18 | public DataAdapter getAdapter(Object adaptee) { |
19 | return new TimeSpanToHistogramAdapter((SensorAndMeasurements) adaptee); |
20 | } |
21 | |
22 | public String getMetricLabel() { |
23 | return "Response Time"; |
24 | } |
25 | |
26 | public String getAdapterFactoryID() { |
27 | return "TimeSpanToHistogramFactory"; |
28 | } |
29 | |
30 | public boolean createsAdaptersFor(Class<?> targetClass) { |
31 | return targetClass.isAssignableFrom(Histogram.class); |
32 | } |
33 | } |