1 | package de.uka.ipd.sdq.reliability.solver.reporting; |
2 | |
3 | /** |
4 | * Class used for aggregation of failure probabilities according to a |
5 | * FailureAnalysisFailureType when considering failure types. |
6 | * |
7 | * @author Daniel Patejdl |
8 | * |
9 | */ |
10 | public class TypesFailureProbabilityAggregation { |
11 | /** |
12 | * The aggregated failure probability. |
13 | */ |
14 | private double failureProbability; |
15 | |
16 | /** |
17 | * The failure analysis failure type. The type may be used to distinguish |
18 | * several instances of this class. |
19 | */ |
20 | private FailureAnalysisFailureType failureType; |
21 | |
22 | /** |
23 | * An additional string used to distinguish several instances of this class. |
24 | */ |
25 | private String typeIdentifier; |
26 | |
27 | /** |
28 | * Creates a new instance of this class, given the failure analysis failure |
29 | * type. |
30 | * |
31 | * @param failureAggregationType |
32 | * the failure analysis failure type |
33 | * @param typeIdentifier |
34 | * the type identifier |
35 | * @param failureProbability |
36 | * the failure probability |
37 | */ |
38 | public TypesFailureProbabilityAggregation( |
39 | FailureAnalysisFailureType failureType, String typeIdentifier, |
40 | double failureProbability) { |
41 | this.failureType = failureType; |
42 | this.typeIdentifier = typeIdentifier; |
43 | this.failureProbability = failureProbability; |
44 | } |
45 | |
46 | /** |
47 | * Adds to the current aggregated failure probability additional failure |
48 | * probability. |
49 | * |
50 | * @param failureProbability |
51 | * the failure probability to be added to the existing one |
52 | */ |
53 | public void addToFailureProbability(double failureProbability) { |
54 | this.failureProbability += failureProbability; |
55 | } |
56 | |
57 | /** |
58 | * Compares this instances failure type and type identifier to another |
59 | * instance's failure type and type identifier. |
60 | * |
61 | * @param otherfailureType |
62 | * the other instance's failure type |
63 | * @param otherTypeIdentifier |
64 | * the other instance's type identifier |
65 | * @return <code>true</code>, if and only if both the failure types and type |
66 | * identifiers match |
67 | */ |
68 | public boolean compareTo(FailureAnalysisFailureType otherfailureType, |
69 | String otherTypeIdentifier) { |
70 | return (failureType == otherfailureType && typeIdentifier == otherTypeIdentifier); |
71 | } |
72 | |
73 | /** |
74 | * Retrieves the aggregated failure probability. |
75 | * |
76 | * @return the aggregated failure probability |
77 | */ |
78 | public double getFailureProbability() { |
79 | return failureProbability; |
80 | } |
81 | |
82 | /** |
83 | * Returns the failure type. |
84 | * |
85 | * @return the failure type |
86 | */ |
87 | public FailureAnalysisFailureType getType() { |
88 | return failureType; |
89 | } |
90 | |
91 | /** |
92 | * Gets the type identifier. |
93 | * |
94 | * @return the type identifier |
95 | */ |
96 | public String getTypeIdentifier() { |
97 | return typeIdentifier; |
98 | } |
99 | |
100 | /** |
101 | * Sets the failure type. |
102 | * |
103 | * @param failureType |
104 | * the failure type |
105 | */ |
106 | public void setType(FailureAnalysisFailureType failureType) { |
107 | this.failureType = failureType; |
108 | } |
109 | |
110 | /** |
111 | * Sets the type identifier |
112 | * |
113 | * @param typeIdentifier |
114 | * the type identifier |
115 | */ |
116 | public void setTypeIdentifier(String typeIdentifier) { |
117 | this.typeIdentifier = typeIdentifier; |
118 | } |
119 | } |