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