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

nameclass, %method, %block, %line, %
NormalDistribution.java0%   (0/1)0%   (0/25)0%   (0/129)0%   (0/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NormalDistribution0%   (0/1)0%   (0/25)0%   (0/129)0%   (0/32)
NormalDistribution (double, double): void 0%   (0/1)0%   (0/12)0%   (0/4)
add (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
checkConstrains (): void 0%   (0/1)0%   (0/1)0%   (0/1)
div (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getArithmeticMeanValue (): double 0%   (0/1)0%   (0/5)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)
getMean (): double 0%   (0/1)0%   (0/5)0%   (0/1)
getMedian (): Object 0%   (0/1)0%   (0/6)0%   (0/1)
getPercentile (int): Object 0%   (0/1)0%   (0/4)0%   (0/1)
getSigma (): double 0%   (0/1)0%   (0/5)0%   (0/1)
getStandardDeviation (): double 0%   (0/1)0%   (0/5)0%   (0/1)
getXinf (): double 0%   (0/1)0%   (0/2)0%   (0/1)
getXsup (): double 0%   (0/1)0%   (0/2)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/14)0%   (0/3)
stretchDomain (double): IProbabilityDensityFunction 0%   (0/1)0%   (0/16)0%   (0/3)
sub (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)

1package de.uka.ipd.sdq.probfunction.math.apache.impl;
2 
3 
4import org.apache.commons.math.distribution.NormalDistributionImpl;
5//import umontreal.iro.lecuyer.probdist.NormalDist;
6import de.uka.ipd.sdq.probfunction.math.INormalDistribution;
7import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction;
8import de.uka.ipd.sdq.probfunction.math.exception.DomainNotNumbersException;
9import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInFrequencyDomainException;
10import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInTimeDomainException;
11import de.uka.ipd.sdq.probfunction.math.exception.FunctionsInDifferenDomainsException;
12import de.uka.ipd.sdq.probfunction.math.exception.IncompatibleUnitsException;
13import de.uka.ipd.sdq.probfunction.math.exception.InvalidSampleValueException;
14import de.uka.ipd.sdq.probfunction.math.exception.NegativeDistanceException;
15import de.uka.ipd.sdq.probfunction.math.exception.ProbabilityFunctionException;
16import de.uka.ipd.sdq.probfunction.math.exception.ProbabilitySumNotOneException;
17import de.uka.ipd.sdq.probfunction.math.exception.UnitNameNotSetException;
18import de.uka.ipd.sdq.probfunction.math.exception.UnitNotSetException;
19import de.uka.ipd.sdq.probfunction.math.exception.UnknownPDFTypeException;
20import de.uka.ipd.sdq.probfunction.math.exception.UnorderedDomainException;
21 
22/**
23 * TODO: A number of calculations are possible, implement them instead of throwing UnsupportedOperationException().
24 * 
25 * See e.g. http://en.wikipedia.org/wiki/List_of_convolutions_of_probability_distributions
26 * @author martens
27 *
28 */
29public class NormalDistribution extends AbstractContinousPDF implements
30                INormalDistribution {
31        
32        public NormalDistribution(double mean, double sigma){
33                double sd = sigma;
34                this.internalFunction = new NormalDistributionImpl(mean, sd);
35        }
36 
37        @Override
38        public double getMean() {
39                return ((NormalDistributionImpl)this.internalFunction).getMean();
40        }
41 
42        @Override
43        public double getSigma() {
44                return ((NormalDistributionImpl)this.internalFunction).getStandardDeviation();
45        }
46 
47        @Override
48        public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf)
49                        throws FunctionsInDifferenDomainsException,
50                        UnknownPDFTypeException, IncompatibleUnitsException {
51                throw new UnsupportedOperationException();
52        }
53 
54        @Override
55        public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf)
56                        throws FunctionsInDifferenDomainsException,
57                        UnknownPDFTypeException, IncompatibleUnitsException {
58                throw new UnsupportedOperationException();
59        }
60 
61        @Override
62        public IProbabilityDensityFunction getCumulativeFunction()
63                        throws FunctionNotInTimeDomainException {
64                throw new UnsupportedOperationException();
65        }
66 
67        @Override
68        public IProbabilityDensityFunction getFourierTransform()
69                        throws FunctionNotInTimeDomainException {
70                throw new UnsupportedOperationException();
71        }
72 
73        @Override
74        public IProbabilityDensityFunction getInverseFourierTransform()
75                        throws FunctionNotInFrequencyDomainException {
76                throw new UnsupportedOperationException();
77        }
78 
79        @Override
80        public double getLowerDomainBorder() {
81                throw new UnsupportedOperationException();
82        }
83 
84        @Override
85        public double greaterThan(IProbabilityDensityFunction pdf)
86                        throws ProbabilityFunctionException {
87                throw new UnsupportedOperationException();
88        }
89 
90        @Override
91        public double lessThan(IProbabilityDensityFunction pdf)
92                        throws ProbabilityFunctionException {
93                throw new UnsupportedOperationException();
94        }
95 
96        @Override
97        public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf)
98                        throws FunctionsInDifferenDomainsException,
99                        UnknownPDFTypeException, IncompatibleUnitsException {
100                throw new UnsupportedOperationException();
101        }
102 
103        @Override
104        public double probabilisticEquals(IProbabilityDensityFunction pdf)
105                        throws ProbabilityFunctionException {
106                throw new UnsupportedOperationException();
107        }
108 
109        @Override
110        public IProbabilityDensityFunction scale(double scalar) {
111                throw new UnsupportedOperationException();
112        }
113 
114        @Override
115        /**
116         * ``substracting a constant [...] reduces the mean [..] by that constant''
117         * Statistical Methods for Psychology Von David C. Howell, p. 72 
118         */
119        public IProbabilityDensityFunction shiftDomain(double scalar)
120                        throws DomainNotNumbersException {
121                double newMean = this.getArithmeticMeanValue() + scalar;
122                double newSigma = this.getSigma();
123                return new NormalDistribution(newMean, newSigma);
124        }
125 
126        @Override
127        /**
128         * ``if we multiply or divide [...] by a constant [..], we multiply of divide the standard deviation by that constant.''
129         * and also the mean (in the cited case the mean was 0). 
130         * Statistical Methods for Psychology Von David C. Howell, p. 72 
131         */
132        public IProbabilityDensityFunction stretchDomain(double scalar) {
133                double newMean = this.getArithmeticMeanValue() * scalar;
134                double newSigma = this.getSigma() * scalar;
135                return new NormalDistribution(newMean, newSigma);
136        }
137 
138        @Override
139        public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf)
140                        throws FunctionsInDifferenDomainsException,
141                        UnknownPDFTypeException, IncompatibleUnitsException {
142                throw new UnsupportedOperationException();
143        }
144 
145        @Override
146        public void checkConstrains() throws NegativeDistanceException,
147                        ProbabilitySumNotOneException, FunctionNotInTimeDomainException,
148                        UnitNotSetException, UnitNameNotSetException,
149                        InvalidSampleValueException {
150                // TODO Auto-generated method stub
151 
152        }
153 
154        @Override
155        public Object getMedian() throws UnorderedDomainException {
156                return ((NormalDistributionImpl)internalFunction).getMean();
157        }
158 
159        @Override
160        public Object getPercentile(int p) throws IndexOutOfBoundsException,
161                        UnorderedDomainException {
162                throw new UnsupportedOperationException();
163        }
164 
165        @Override
166        public boolean hasOrderedDomain() {
167                throw new UnsupportedOperationException();
168        }
169 
170        @Override
171        public double getStandardDeviation() {
172                return ((NormalDistributionImpl)internalFunction).getStandardDeviation();
173        }
174 
175        @Override
176        public double getXinf() {
177                
178                return Double.NEGATIVE_INFINITY;
179        }
180 
181        @Override
182        public double getXsup() {
183                return Double.POSITIVE_INFINITY;
184        }
185 
186        @Override
187        public double getArithmeticMeanValue() throws DomainNotNumbersException,
188                        FunctionNotInTimeDomainException {
189                return ((NormalDistributionImpl)internalFunction).getMean();
190                }
191 
192}

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