EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.reliability.solver.pcm2markov]

COVERAGE SUMMARY FOR SOURCE FILE [ProcessingResourceDescriptor.java]

nameclass, %method, %block, %line, %
ProcessingResourceDescriptor.java0%   (0/1)0%   (0/16)0%   (0/103)0%   (0/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProcessingResourceDescriptor0%   (0/1)0%   (0/16)0%   (0/103)0%   (0/35)
ProcessingResourceDescriptor (): void 0%   (0/1)0%   (0/35)0%   (0/10)
getCurrentState (): MarkovResourceState 0%   (0/1)0%   (0/3)0%   (0/1)
getDefaultState (): MarkovResourceState 0%   (0/1)0%   (0/2)0%   (0/1)
getResourceContainerId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getResourceContainerName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getStateProbability (MarkovResourceState): Double 0%   (0/1)0%   (0/6)0%   (0/1)
getType (): MarkovResourceType 0%   (0/1)0%   (0/3)0%   (0/1)
isRequiredByContainer (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
setContainerId (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setContainerName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setCurrentState (MarkovResourceState): void 0%   (0/1)0%   (0/4)0%   (0/2)
setId (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
setName (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
setRequiredByContainer (boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
setStateProbability (MarkovResourceState, Double): void 0%   (0/1)0%   (0/7)0%   (0/2)
switchState (): void 0%   (0/1)0%   (0/12)0%   (0/4)

1package de.uka.ipd.sdq.reliability.solver.pcm2markov;
2 
3import java.util.HashMap;
4 
5/**
6 * Describes the characteristics of a PCM processing resource with respect to
7 * its availability.
8 * 
9 * @author brosch
10 * 
11 */
12public class ProcessingResourceDescriptor {
13 
14        /**
15         * The default value for members of this class that have not been specified.
16         */
17        static final String NOTSPECIFIED = "UNKNOWN";
18 
19        /**
20         * The id of the surrounding resource container.
21         */
22        private String containerId;
23 
24        /**
25         * The name of the surrounding resource container.
26         */
27        private String containerName;
28 
29        /**
30         * The current state during Markov analysis.
31         */
32        private MarkovResourceState currentState;
33 
34        /**
35         * Indicates if unavailability of this resource leads to unavailability of
36         * the surrounding resource container.
37         */
38        private boolean requiredByContainer;
39 
40        /**
41         * The probabilities of each resource state.
42         */
43        private HashMap<MarkovResourceState, Double> stateProbabilities = new HashMap<MarkovResourceState, Double>();
44 
45        /**
46         * The type of resource.
47         */
48        private MarkovResourceType type;
49 
50        /**
51         * The constructor.
52         */
53        public ProcessingResourceDescriptor() {
54 
55                // Provide consistent default state probabilities:
56                setStateProbability(MarkovResourceState.OK, 1.0);
57                setStateProbability(MarkovResourceState.NA, 0.0);
58 
59                // Set default values:
60                setCurrentState(MarkovResourceState.OK);
61                setContainerId(NOTSPECIFIED);
62                setContainerName(NOTSPECIFIED);
63                setRequiredByContainer(false);
64 
65                // Set type information:
66                type = new MarkovResourceType();
67        }
68 
69        /**
70         * Gets the current resource state.
71         * 
72         * @return the current state
73         */
74        public MarkovResourceState getCurrentState() {
75                return currentState;
76        }
77 
78        /**
79         * Returns the default state of this resource.
80         * 
81         * @return the default state
82         */
83        public MarkovResourceState getDefaultState() {
84                return MarkovResourceState.OK;
85        }
86 
87        /**
88         * Gets the id of the surrounding resource container.
89         * 
90         * @return the id
91         */
92        public String getResourceContainerId() {
93                return containerId;
94        }
95 
96        /**
97         * Gets the name of the surrounding resource container.
98         * 
99         * @return the name
100         */
101        public String getResourceContainerName() {
102                return containerName;
103        }
104 
105        /**
106         * Retrieves the probability of a given resource state.
107         * 
108         * @param state
109         *            the resource state
110         * @return the probability
111         */
112        public Double getStateProbability(final MarkovResourceState state) {
113                return stateProbabilities.get(state);
114        }
115 
116        /**
117         * Retrieves the resource type.
118         * 
119         * @return the resource type
120         */
121        public MarkovResourceType getType() {
122                return type;
123        }
124 
125        /**
126         * Retrieves the availability relation to the surrounding resource
127         * container.
128         * 
129         * @return the availability relation to the surrounding resource container
130         */
131        public boolean isRequiredByContainer() {
132                return requiredByContainer;
133        }
134 
135        /**
136         * Sets the id of the surrounding resource container.
137         * 
138         * @param resourceContainerId
139         *            the id to set
140         */
141        public void setContainerId(final String resourceContainerId) {
142                this.containerId = resourceContainerId;
143        }
144 
145        /**
146         * Sets the name of the surrounding resource container.
147         * 
148         * @param resourceContainerName
149         *            the name to set
150         */
151        public void setContainerName(final String resourceContainerName) {
152                this.containerName = resourceContainerName;
153        }
154 
155        /**
156         * Sets the current resource state.
157         * 
158         * @param state
159         *            the state to set
160         */
161        public void setCurrentState(final MarkovResourceState state) {
162                currentState = state;
163        }
164 
165        /**
166         * Sets the resource type id.
167         * 
168         * @param typeId
169         *            the resource type id to set
170         */
171        public void setId(String typeId) {
172                this.type.setId(typeId);
173        }
174 
175        /**
176         * Sets the resource type name.
177         * 
178         * @param typeName
179         *            the resource type name to set
180         */
181        public void setName(String typeName) {
182                this.type.setName(typeName);
183        }
184 
185        /**
186         * Sets the availability relation to the surrounding resource container.
187         * 
188         * @param requiredByContainer
189         *            the availability relation to the surrounding resource
190         *            container
191         */
192        public void setRequiredByContainer(final boolean requiredByContainer) {
193                this.requiredByContainer = requiredByContainer;
194        }
195 
196        /**
197         * Sets a probability for a given resource state.
198         * 
199         * @param state
200         *            the resource state
201         * @param probability
202         *            the probability
203         */
204        public void setStateProbability(final MarkovResourceState state,
205                        final Double probability) {
206                stateProbabilities.put(state, probability);
207        }
208 
209        /**
210         * Switches the state from either ProcessingResourceState.OK to
211         * ProcessingResourceState.NA or ProcessingResourceState.NA to
212         * ProcessingResourceState.OK.
213         */
214        public void switchState() {
215                if (currentState == MarkovResourceState.OK) {
216                        currentState = MarkovResourceState.NA;
217                } else {
218                        currentState = MarkovResourceState.OK;
219                }
220        }
221}

[all classes][de.uka.ipd.sdq.reliability.solver.pcm2markov]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov