1 | package de.uka.ipd.sdq.sensorframework.adapter; |
2 | |
3 | import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.FrequencyFailurePie; |
4 | import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements; |
5 | import de.uka.ipd.sdq.sensorframework.entities.StateSensor; |
6 | |
7 | public class StateSensorToFrequencyFailurePieFactory 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 StateSensor) { |
13 | if (FrequencyFailurePie.class == targetClass) { |
14 | return true; |
15 | } |
16 | } |
17 | } |
18 | return false; |
19 | } |
20 | |
21 | public DataAdapter getAdapter(Object adaptee) { |
22 | return new StateSensorToFrequencyFailurePieAdapter( |
23 | (SensorAndMeasurements) adaptee); |
24 | } |
25 | |
26 | public String getMetricLabel() { |
27 | return "Execution Result (failures only)"; |
28 | } |
29 | |
30 | public String getAdapterFactoryID() { |
31 | return "StateSensorToFrequencyFailurePieFactory"; |
32 | } |
33 | |
34 | public boolean createsAdaptersFor(Class<?> targetClass) { |
35 | return targetClass.isAssignableFrom(FrequencyFailurePie.class); |
36 | } |
37 | |
38 | } |