EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.probfunction.math.apache.impl]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractDiscretePDF.java]

nameclass, %method, %block, %line, %
AbstractDiscretePDF.java0%   (0/1)0%   (0/26)0%   (0/152)0%   (0/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractDiscretePDF0%   (0/1)0%   (0/26)0%   (0/152)0%   (0/41)
AbstractDiscretePDF (): void 0%   (0/1)0%   (0/9)0%   (0/4)
add (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
cdf (double): double 0%   (0/1)0%   (0/12)0%   (0/3)
cdf (int): double 0%   (0/1)0%   (0/12)0%   (0/3)
checkConstrains (): void 0%   (0/1)0%   (0/4)0%   (0/1)
div (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
drawSample (): double 0%   (0/1)0%   (0/23)0%   (0/5)
getCoefficientOfVariance (): double 0%   (0/1)0%   (0/6)0%   (0/1)
getCumulativeFunction (): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getFourierTransform (): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getInverseFourierTransform (): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getProbabilitySum (): double 0%   (0/1)0%   (0/2)0%   (0/1)
getUnit (): IUnit 0%   (0/1)0%   (0/2)0%   (0/1)
getVariance (): double 0%   (0/1)0%   (0/7)0%   (0/2)
greaterThan (IProbabilityDensityFunction): double 0%   (0/1)0%   (0/4)0%   (0/1)
inverseF (double): int 0%   (0/1)0%   (0/14)0%   (0/4)
isInFrequencyDomain (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
isInTimeDomain (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
lessThan (IProbabilityDensityFunction): double 0%   (0/1)0%   (0/4)0%   (0/1)
mult (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
probabilisticEquals (IProbabilityDensityFunction): double 0%   (0/1)0%   (0/4)0%   (0/1)
probability (int): double 0%   (0/1)0%   (0/5)0%   (0/1)
scale (double): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
shiftDomain (double): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
stretchDomain (double): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
sub (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)

1package de.uka.ipd.sdq.probfunction.math.apache.impl;
2 
3import org.apache.commons.math.MathException;
4import org.apache.commons.math.distribution.AbstractIntegerDistribution;
5 
6 
7import de.uka.ipd.sdq.probfunction.math.IDiscretePDF;
8import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction;
9import de.uka.ipd.sdq.probfunction.math.IRandomGenerator;
10import de.uka.ipd.sdq.probfunction.math.IUnit;
11import de.uka.ipd.sdq.probfunction.math.exception.DomainNotNumbersException;
12import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInFrequencyDomainException;
13import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInTimeDomainException;
14import de.uka.ipd.sdq.probfunction.math.exception.FunctionsInDifferenDomainsException;
15import de.uka.ipd.sdq.probfunction.math.exception.IncompatibleUnitsException;
16import de.uka.ipd.sdq.probfunction.math.exception.InvalidSampleValueException;
17import de.uka.ipd.sdq.probfunction.math.exception.NegativeDistanceException;
18import de.uka.ipd.sdq.probfunction.math.exception.ProbabilityFunctionException;
19import de.uka.ipd.sdq.probfunction.math.exception.ProbabilitySumNotOneException;
20import de.uka.ipd.sdq.probfunction.math.exception.UnitNameNotSetException;
21import de.uka.ipd.sdq.probfunction.math.exception.UnitNotSetException;
22import de.uka.ipd.sdq.probfunction.math.exception.UnknownPDFTypeException;
23 
24public abstract class AbstractDiscretePDF implements IDiscretePDF {
25 
26        protected AbstractIntegerDistribution internalFunction = null;
27        protected IRandomGenerator sampleDrawer = null;
28        
29                
30        public AbstractDiscretePDF() {
31                super();
32        }
33 
34        /**
35         * Returns the distribution function F(x) as defined in 
36         * {@link umontreal.iro.lecuyer.probdist.Distribution#cdf(double)}
37         * @param x
38         * @return F(x)
39         */
40        public double cdf(int x){
41                try {
42                        return this.internalFunction.cumulativeProbability(x);
43                } catch (MathException e) {
44                        throw new ProbabilityFunctionException(e.getLocalizedMessage());
45                }
46        }
47 
48        
49        
50        public double getCoefficientOfVariance() {
51                return this.getStandardDeviation() / this.getArithmeticMeanValue();
52        }
53 
54 
55        public double getVariance() {
56                double std = this.getStandardDeviation();
57                return std * std;
58        }
59 
60        public double getProbabilitySum() {
61                return 1;
62        }
63 
64        @Override
65        public double probability(int x) {
66                return internalFunction.probability(x);
67        }
68 
69 
70 
71        public boolean isInFrequencyDomain() {
72                return false;
73        }
74 
75        public boolean isInTimeDomain() {
76                return true;
77        }
78        
79        /**
80         * Returns the distribution function F(x) as defined in 
81         * {@link umontreal.iro.lecuyer.probdist.Distribution#cdf(double)}
82         * @param x
83         * @return F(x)
84         */
85        public double cdf(double x){
86                try {
87                        return this.internalFunction.cumulativeProbability(x);
88                } catch (MathException e) {
89                        throw new ProbabilityFunctionException(e.getLocalizedMessage());
90                }
91        }
92        
93        
94        
95        public double drawSample() {
96                if (sampleDrawer == null) {
97                        throw new ProbabilityFunctionException("RNG was not set!");
98 
99                }
100                try {
101                        return internalFunction.inverseCumulativeProbability(sampleDrawer.random());
102                } catch (MathException e) {
103                        throw new ProbabilityFunctionException(e.getLocalizedMessage());
104                }
105        }
106 
107 
108        
109 
110 
111        /**
112         * Computes and returns the inverse distribution function x = F^{-1}(u). 
113         * This can be used to get the quantiles of the distribution. 
114         * Pass 0.9 to get the x value of this function for which this.cdf(x) = 0.9 holds.
115         * Uses the implementation of the concrete function in the {@link umontreal.iro.lecuyer.probdist} package. 
116         * @param u - value in the interval [0, 1] for which the inverse distribution function is evaluated 
117         * @return the inverse distribution function evaluated at u
118         */
119        public int inverseF(double u) {
120                
121                try {
122                        return this.internalFunction.inverseCumulativeProbability(u);
123                } catch (MathException e) {
124                        e.printStackTrace();
125                        throw new ProbabilityFunctionException(e.getLocalizedMessage());
126                }
127        }
128 
129 
130        public IUnit getUnit() {
131                return null;
132        }
133        
134        
135 
136 
137 
138        @Override
139        public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf)
140                        throws FunctionsInDifferenDomainsException,
141                        UnknownPDFTypeException, IncompatibleUnitsException {
142                throw new UnsupportedOperationException();
143        }
144 
145 
146 
147        @Override
148        public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf)
149                        throws FunctionsInDifferenDomainsException,
150                        UnknownPDFTypeException, IncompatibleUnitsException {
151                throw new UnsupportedOperationException();
152                
153        }
154 
155 
156 
157        @Override
158        public IProbabilityDensityFunction getCumulativeFunction()
159                        throws FunctionNotInTimeDomainException {
160                throw new UnsupportedOperationException();
161        }
162 
163 
164 
165        @Override
166        public IProbabilityDensityFunction getFourierTransform()
167                        throws FunctionNotInTimeDomainException {
168                throw new UnsupportedOperationException();
169        }
170 
171 
172 
173        @Override
174        public IProbabilityDensityFunction getInverseFourierTransform()
175                        throws FunctionNotInFrequencyDomainException {
176                throw new UnsupportedOperationException();
177        }
178 
179 
180 
181        
182 
183 
184 
185        @Override
186        public double greaterThan(IProbabilityDensityFunction pdf)
187                        throws ProbabilityFunctionException {
188                throw new UnsupportedOperationException();
189        }
190 
191 
192 
193        @Override
194        public double lessThan(IProbabilityDensityFunction pdf)
195                        throws ProbabilityFunctionException {
196                throw new UnsupportedOperationException();
197        }
198 
199 
200 
201        @Override
202        public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf)
203                        throws FunctionsInDifferenDomainsException,
204                        UnknownPDFTypeException, IncompatibleUnitsException {
205                throw new UnsupportedOperationException();
206        }
207 
208 
209 
210        @Override
211        public double probabilisticEquals(IProbabilityDensityFunction pdf)
212                        throws ProbabilityFunctionException {
213                throw new UnsupportedOperationException();
214        }
215 
216 
217 
218        @Override
219        public IProbabilityDensityFunction scale(double scalar) {
220                throw new UnsupportedOperationException();
221        }
222 
223 
224 
225        @Override
226        public IProbabilityDensityFunction shiftDomain(double scalar)
227                        throws DomainNotNumbersException {
228                throw new UnsupportedOperationException();
229        }
230 
231 
232 
233        @Override
234        public IProbabilityDensityFunction stretchDomain(double scalar) {
235                throw new UnsupportedOperationException();
236        }
237 
238 
239 
240        @Override
241        public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf)
242                        throws FunctionsInDifferenDomainsException,
243                        UnknownPDFTypeException, IncompatibleUnitsException {
244                throw new UnsupportedOperationException();
245        }
246 
247 
248 
249        @Override
250        public void checkConstrains() throws NegativeDistanceException,
251                        ProbabilitySumNotOneException, FunctionNotInTimeDomainException,
252                        UnitNotSetException, UnitNameNotSetException,
253                        InvalidSampleValueException {
254                throw new UnsupportedOperationException();
255                
256        }
257 
258 
259 
260        
261 
262        
263        
264        
265 
266 
267}

[all classes][de.uka.ipd.sdq.probfunction.math.apache.impl]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov