1 | package de.uka.ipd.sdq.reliability.core; |
2 | |
3 | /** |
4 | * Represents a type identification for failure-on-demand occurrences during the |
5 | * reliability analysis / simulation. |
6 | * |
7 | * @author brosch |
8 | * |
9 | */ |
10 | public abstract class MarkovFailureType implements |
11 | Comparable<MarkovFailureType> { |
12 | |
13 | /** |
14 | * The degree of differentiation between failure types. |
15 | */ |
16 | protected MarkovEvaluationType evaluationType = MarkovEvaluationType.POINTSOFFAILURE; |
17 | |
18 | /** |
19 | * A default id for new failure types. |
20 | */ |
21 | protected static String DEFAULT_ID = "Failure"; |
22 | |
23 | /** |
24 | * A default name for new failure types. |
25 | */ |
26 | protected static String DEFAULT_NAME = "Failure"; |
27 | |
28 | /** |
29 | * The ID of this failure type. |
30 | * |
31 | * The ID is unique across all failure types within an analysis or |
32 | * simulation run. |
33 | */ |
34 | protected String id = null; |
35 | |
36 | /** |
37 | * The id of the (system-required) interface which exhibits the failure. |
38 | */ |
39 | protected String interfaceId = ""; |
40 | |
41 | /** |
42 | * The name of the (system-required) interface which exhibits the failure. |
43 | */ |
44 | protected String interfaceName = ""; |
45 | |
46 | /** |
47 | * The human-readable name of this failure type. |
48 | */ |
49 | protected String name = null; |
50 | |
51 | /** |
52 | * The id of the (system-required) role which exhibits the failure. |
53 | */ |
54 | protected String roleId = ""; |
55 | |
56 | /** |
57 | * The name of the (system-required) role which exhibits the failure. |
58 | */ |
59 | protected String roleName = ""; |
60 | |
61 | /** |
62 | * The id of the (system-required) signature which exhibits the failure. |
63 | */ |
64 | protected String signatureId = ""; |
65 | |
66 | /** |
67 | * The name of the (system-required) signature which exhibits the failure. |
68 | */ |
69 | protected String signatureName = ""; |
70 | |
71 | /** |
72 | * Indicates if this failure type is system-external, i.e. originated |
73 | * outside the system. |
74 | * |
75 | * By default, failure types are instantiated as being internal. |
76 | */ |
77 | protected boolean systemExternal = false; |
78 | |
79 | /* |
80 | * (non-Javadoc) |
81 | * |
82 | * @see java.lang.Comparable#compareTo(java.lang.Object) |
83 | */ |
84 | public int compareTo(MarkovFailureType o) { |
85 | // The comparison is done by name: |
86 | return getName().compareTo(o.getName()); |
87 | } |
88 | |
89 | /* |
90 | * (non-Javadoc) |
91 | * |
92 | * @see java.lang.Object#equals(java.lang.Object) |
93 | */ |
94 | public boolean equals(Object obj) { |
95 | |
96 | // The equality test is based on (the failure type class and) the ID |
97 | // attribute: |
98 | if (evaluationType == MarkovEvaluationType.SINGLE) { |
99 | return (obj instanceof MarkovFailureType) |
100 | && (this.getId().equals(((MarkovFailureType) obj).getId())); |
101 | } else { |
102 | return (this.getClass().equals(obj.getClass())) |
103 | && (this.getId().equals(((MarkovFailureType) obj).getId())); |
104 | } |
105 | } |
106 | |
107 | /** |
108 | * Retrieves the ID of this failure type. |
109 | * |
110 | * @return the ID of this failure type |
111 | */ |
112 | public String getId() { |
113 | return id; |
114 | } |
115 | |
116 | /** |
117 | * Retrieves the id of the (system-required) interface which exhibits the |
118 | * failure. |
119 | * |
120 | * @return the interface id |
121 | */ |
122 | public String getInterfaceId() { |
123 | return interfaceId; |
124 | } |
125 | |
126 | /** |
127 | * Retrieves the name of the (system-required) interface which exhibits the |
128 | * failure. |
129 | * |
130 | * @return the interface name |
131 | */ |
132 | public String getInterfaceName() { |
133 | return interfaceName; |
134 | } |
135 | |
136 | /** |
137 | * Retrieves a name of this failure type. |
138 | * |
139 | * The name is used for describing the failure type in the simulation result |
140 | * data. |
141 | * |
142 | * @return the name of this failure type. |
143 | */ |
144 | public String getName() { |
145 | return name; |
146 | } |
147 | |
148 | /** |
149 | * Retrieves the id of the (system-required) role which exhibits the |
150 | * failure. |
151 | * |
152 | * @return the role id |
153 | */ |
154 | public String getRoleId() { |
155 | return roleId; |
156 | } |
157 | |
158 | /** |
159 | * Retrieves the name of the (system-required) role which exhibits the |
160 | * failure. |
161 | * |
162 | * @return the role name |
163 | */ |
164 | public String getRoleName() { |
165 | return roleName; |
166 | } |
167 | |
168 | /** |
169 | * Retrieves the id of the (system-required) signature which exhibits the |
170 | * failure. |
171 | * |
172 | * @return the signature id |
173 | */ |
174 | public String getSignatureId() { |
175 | return signatureId; |
176 | } |
177 | |
178 | /** |
179 | * Retrieves the name of the (system-required) signature which exhibits the |
180 | * failure. |
181 | * |
182 | * @return the signature name |
183 | */ |
184 | public String getSignatureName() { |
185 | return signatureName; |
186 | } |
187 | |
188 | /** |
189 | * Indicates if this failure type is system-external, i.e. originated |
190 | * outside the system. |
191 | * |
192 | * @return |
193 | */ |
194 | public boolean isSystemExternal() { |
195 | return systemExternal; |
196 | } |
197 | } |