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 [AbstractContinousPDF.java]

nameclass, %method, %block, %line, %
AbstractContinousPDF.java100% (1/1)16%  (4/25)15%  (21/139)18%  (7/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractContinousPDF100% (1/1)16%  (4/25)15%  (21/139)18%  (7/38)
add (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
checkConstrains (): void 0%   (0/1)0%   (0/4)0%   (0/1)
density (double): double 0%   (0/1)0%   (0/5)0%   (0/1)
div (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
drawSample (): double 0%   (0/1)0%   (0/22)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)
getVariance (): double 0%   (0/1)0%   (0/7)0%   (0/2)
greaterThan (IProbabilityDensityFunction): double 0%   (0/1)0%   (0/4)0%   (0/1)
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)
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)
inverseF (double): double 100% (1/1)36%  (5/14)25%  (1/4)
cdf (double): double 100% (1/1)42%  (5/12)33%  (1/3)
AbstractContinousPDF (): void 100% (1/1)100% (9/9)100% (4/4)
getUnit (): IUnit 100% (1/1)100% (2/2)100% (1/1)

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

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