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

nameclass, %method, %block, %line, %
GammaDistribution.java100% (1/1)10%  (3/29)9%   (14/164)12%  (5/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GammaDistribution100% (1/1)10%  (3/29)9%   (14/164)12%  (5/40)
GammaDistribution (): void 0%   (0/1)0%   (0/3)0%   (0/2)
GammaDistribution (GammaDistributionImpl): void 0%   (0/1)0%   (0/6)0%   (0/3)
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/10)0%   (0/3)
div (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getAlpha (): double 0%   (0/1)0%   (0/5)0%   (0/1)
getArithmeticMeanValue (): 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)
getLowerDomainBorder (): double 0%   (0/1)0%   (0/4)0%   (0/1)
getMedian (): Object 0%   (0/1)0%   (0/4)0%   (0/1)
getPercentile (int): Object 0%   (0/1)0%   (0/4)0%   (0/1)
getStandardDeviation (): double 0%   (0/1)0%   (0/4)0%   (0/1)
getTheta (): double 0%   (0/1)0%   (0/5)0%   (0/1)
getVariance (): double 0%   (0/1)0%   (0/9)0%   (0/1)
greaterThan (IProbabilityDensityFunction): double 0%   (0/1)0%   (0/4)0%   (0/1)
hasOrderedDomain (): boolean 0%   (0/1)0%   (0/4)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/17)0%   (0/3)
stretchDomain (double): IProbabilityDensityFunction 0%   (0/1)0%   (0/21)0%   (0/3)
sub (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
GammaDistribution (double, double): void 100% (1/1)100% (10/10)100% (3/3)
getXinf (): double 100% (1/1)100% (2/2)100% (1/1)
getXsup (): double 100% (1/1)100% (2/2)100% (1/1)

1package de.uka.ipd.sdq.probfunction.math.apache.impl;
2 
3 
4import org.apache.commons.math.distribution.GammaDistributionImpl;
5//import umontreal.iro.lecuyer.probdist.GammaDist;
6//import umontreal.iro.lecuyer.probdist.GammaDistFromMoments;
7import de.uka.ipd.sdq.probfunction.math.IGammaDistribution;
8import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction;
9import de.uka.ipd.sdq.probfunction.math.apache.distribution.GammaDistributionFromMomentsImpl;
10import de.uka.ipd.sdq.probfunction.math.exception.DomainNotNumbersException;
11import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInFrequencyDomainException;
12import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInTimeDomainException;
13import de.uka.ipd.sdq.probfunction.math.exception.FunctionsInDifferenDomainsException;
14import de.uka.ipd.sdq.probfunction.math.exception.IncompatibleUnitsException;
15import de.uka.ipd.sdq.probfunction.math.exception.InvalidSampleValueException;
16import de.uka.ipd.sdq.probfunction.math.exception.NegativeDistanceException;
17import de.uka.ipd.sdq.probfunction.math.exception.ProbabilityFunctionException;
18import de.uka.ipd.sdq.probfunction.math.exception.ProbabilitySumNotOneException;
19import de.uka.ipd.sdq.probfunction.math.exception.UnitNameNotSetException;
20import de.uka.ipd.sdq.probfunction.math.exception.UnitNotSetException;
21import de.uka.ipd.sdq.probfunction.math.exception.UnknownPDFTypeException;
22import de.uka.ipd.sdq.probfunction.math.exception.UnorderedDomainException;
23 
24/**
25 * @see IGammaDistribution
26 * @author martens
27 */
28public class GammaDistribution extends AbstractContinousPDF implements IGammaDistribution {
29 
30        /**
31         *  Constructs a GammaDist object with parameters alpha and theta.
32         * @param alpha shape parameter
33         * @param theta scale parameter = 1 / rate parameter
34         */
35        public GammaDistribution(double alpha, double theta) {
36                super();
37                /* 
38                 * In contrast to SSJ apache common math uses beta as a direct replacement of theta! 
39                 * No 1/theta required!
40                 */ 
41                this.internalFunction = new GammaDistributionImpl(alpha, theta);
42        }
43        
44        @Override
45        public double density(double x) {
46                //SSJ compatibility
47                if(x == 0.0)
48                        return 0.0;
49                
50                return super.density(x);
51        }
52 
53        protected GammaDistribution(){
54                super();
55        }
56 
57        private GammaDistribution(GammaDistributionImpl internal) {
58                super();
59                this.internalFunction = internal;
60        }
61 
62        
63        public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf)
64                        throws FunctionsInDifferenDomainsException,
65                        UnknownPDFTypeException, IncompatibleUnitsException {
66                throw new UnsupportedOperationException();
67        }
68 
69        
70        public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf)
71                        throws FunctionsInDifferenDomainsException,
72                        UnknownPDFTypeException, IncompatibleUnitsException {
73                throw new UnsupportedOperationException();
74        }
75 
76        public IProbabilityDensityFunction getFourierTransform()
77                        throws FunctionNotInTimeDomainException {
78                throw new UnsupportedOperationException();
79        }
80 
81        
82        public IProbabilityDensityFunction getInverseFourierTransform()
83                        throws FunctionNotInFrequencyDomainException {
84                throw new UnsupportedOperationException();
85        }
86 
87        
88        public double getLowerDomainBorder() {
89                throw new UnsupportedOperationException();
90        }
91 
92        
93        public double greaterThan(IProbabilityDensityFunction pdf)
94                        throws ProbabilityFunctionException {
95                throw new UnsupportedOperationException();
96        }
97 
98        
99        public double lessThan(IProbabilityDensityFunction pdf)
100                        throws ProbabilityFunctionException {
101                throw new UnsupportedOperationException();
102        }
103 
104        
105        public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf)
106                        throws FunctionsInDifferenDomainsException,
107                        UnknownPDFTypeException, IncompatibleUnitsException {
108                throw new UnsupportedOperationException();
109        }
110 
111        
112        public double probabilisticEquals(IProbabilityDensityFunction pdf)
113                        throws ProbabilityFunctionException {
114                throw new UnsupportedOperationException();
115        }
116 
117        
118        public IProbabilityDensityFunction scale(double scalar) {
119                throw new UnsupportedOperationException();
120        }
121 
122        
123        public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf)
124                        throws FunctionsInDifferenDomainsException,
125                        UnknownPDFTypeException, IncompatibleUnitsException {
126                throw new UnsupportedOperationException();
127        }
128 
129        
130        public void checkConstrains() throws NegativeDistanceException,
131                        ProbabilitySumNotOneException, FunctionNotInTimeDomainException,
132                        UnitNotSetException, UnitNameNotSetException,
133                        InvalidSampleValueException {
134                throw new UnsupportedOperationException();
135 
136        }
137 
138 
139        
140        public Object getMedian() throws UnorderedDomainException {
141                throw new UnsupportedOperationException();
142        }
143 
144        
145        public Object getPercentile(int p) throws IndexOutOfBoundsException,
146                        UnorderedDomainException {
147                throw new UnsupportedOperationException();
148        }
149        
150        public boolean hasOrderedDomain() {
151                throw new UnsupportedOperationException();
152        }
153 
154        /**
155         * Shape parameter
156         */
157        public double getAlpha() {
158                return ((GammaDistributionImpl)this.internalFunction).getAlpha();
159        }
160 
161        /**
162         * Scale parameter beta
163         */
164        public double getTheta() {
165                return ((GammaDistributionImpl)this.internalFunction).getBeta();
166        }
167 
168        
169        public IProbabilityDensityFunction getCumulativeFunction()
170                        throws FunctionNotInTimeDomainException {
171                throw new UnsupportedOperationException();
172        }
173 
174        
175        public IProbabilityDensityFunction shiftDomain(double scalar)
176                        throws DomainNotNumbersException {
177                double newMean = this.getArithmeticMeanValue() + scalar;
178                double newVariance = this.getVariance();
179                return new GammaDistribution(new GammaDistributionFromMomentsImpl(newMean, newVariance));
180        }
181 
182        
183        @Override
184        public double getVariance() 
185        {
186                //variance is easier to calculate for gamma than sd
187                return this.getAlpha()*this.getTheta()*this.getTheta();
188        }
189 
190        public IProbabilityDensityFunction stretchDomain(double scalar) {
191                double newMean = this.getArithmeticMeanValue() * scalar;
192                double newVariance = this.getVariance() * scalar * scalar;
193                return new GammaDistribution(new GammaDistributionFromMomentsImpl(newMean, newVariance));
194        }
195 
196        @Override
197        public double getStandardDeviation() {
198                return Math.sqrt(this.getVariance());
199        }
200 
201        @Override
202        public double getXinf() {
203                return 0.0;
204        }
205 
206        @Override
207        public double getXsup() {
208                return Double.POSITIVE_INFINITY;
209        }
210 
211        @Override
212        public double getArithmeticMeanValue() throws DomainNotNumbersException,
213                        FunctionNotInTimeDomainException {
214                return this.getAlpha()*this.getTheta();
215        }
216}

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