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

nameclass, %method, %block, %line, %
ChiSquareDistribution.java0%   (0/1)0%   (0/26)0%   (0/138)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ChiSquareDistribution0%   (0/1)0%   (0/26)0%   (0/138)0%   (0/31)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
ChiSquareDistribution (int): void 0%   (0/1)0%   (0/22)0%   (0/5)
add (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
checkConstrains (): void 0%   (0/1)0%   (0/4)0%   (0/1)
div (IProbabilityDensityFunction): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getArithmeticMeanValue (): double 0%   (0/1)0%   (0/3)0%   (0/1)
getCumulativeFunction (): IProbabilityDensityFunction 0%   (0/1)0%   (0/4)0%   (0/1)
getDegreesOfFreedom (): double 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/19)0%   (0/2)
getPercentile (int): Object 0%   (0/1)0%   (0/4)0%   (0/1)
getStandardDeviation (): double 0%   (0/1)0%   (0/4)0%   (0/1)
getVariance (): double 0%   (0/1)0%   (0/6)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/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.distribution.ChiSquaredDistributionImpl;
4 
5import de.uka.ipd.sdq.probfunction.math.IChiSquareDistribution;
6import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction;
7import de.uka.ipd.sdq.probfunction.math.exception.DomainNotNumbersException;
8import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInFrequencyDomainException;
9import de.uka.ipd.sdq.probfunction.math.exception.FunctionNotInTimeDomainException;
10import de.uka.ipd.sdq.probfunction.math.exception.FunctionsInDifferenDomainsException;
11import de.uka.ipd.sdq.probfunction.math.exception.IncompatibleUnitsException;
12import de.uka.ipd.sdq.probfunction.math.exception.InvalidSampleValueException;
13import de.uka.ipd.sdq.probfunction.math.exception.NegativeDistanceException;
14import de.uka.ipd.sdq.probfunction.math.exception.ProbabilityFunctionException;
15import de.uka.ipd.sdq.probfunction.math.exception.ProbabilitySumNotOneException;
16import de.uka.ipd.sdq.probfunction.math.exception.UnitNameNotSetException;
17import de.uka.ipd.sdq.probfunction.math.exception.UnitNotSetException;
18import de.uka.ipd.sdq.probfunction.math.exception.UnknownPDFTypeException;
19import de.uka.ipd.sdq.probfunction.math.exception.UnorderedDomainException;
20 
21/**
22 * Chi-square distribution. The chi-square distribution has a single parameter called the degrees of
23 * freedoms.
24 * <p>
25 * The implementation of this class is partly based on the information given in [1].
26 * <p>
27 * [1] http://en.wikipedia.org/w/index.php?title=Chi-squared_distribution&oldid=461800524
28 * 
29 * @author Philipp Merkle
30 * 
31 */
32public class ChiSquareDistribution extends AbstractContinousPDF implements IChiSquareDistribution {
33 
34    private int degreesOfFreedom;
35 
36    /**
37     * Default constructor.
38     * 
39     * @param degreesOfFreedom
40     *            the parameter of this distribution, which must be a positive integer
41     */
42    public ChiSquareDistribution(int degreesOfFreedom) {
43        assert (degreesOfFreedom > 0) : "The parameter degrees of freedom must be a positive integer.";
44        this.degreesOfFreedom = degreesOfFreedom;
45        this.internalFunction = new ChiSquaredDistributionImpl(degreesOfFreedom);
46    }
47 
48    @Override
49    public double getDegreesOfFreedom() {
50        return this.degreesOfFreedom;
51    }
52 
53    @Override
54    public double getVariance() {
55        // this method has been implemented in accordance with [1]
56        return 2.0 * this.degreesOfFreedom;
57    }
58 
59    @Override
60    public double getStandardDeviation() {
61        return Math.sqrt(this.getVariance());
62    }
63 
64    @Override
65    public double getXinf() {
66        return 0;
67    }
68 
69    @Override
70    public double getXsup() {
71        return Double.POSITIVE_INFINITY;
72    }
73 
74    @Override
75    public IProbabilityDensityFunction add(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException,
76            UnknownPDFTypeException, IncompatibleUnitsException {
77        throw new UnsupportedOperationException();
78    }
79 
80    @Override
81    public IProbabilityDensityFunction div(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException,
82            UnknownPDFTypeException, IncompatibleUnitsException {
83        throw new UnsupportedOperationException();
84    }
85 
86    @Override
87    public IProbabilityDensityFunction getCumulativeFunction() throws FunctionNotInTimeDomainException {
88        throw new UnsupportedOperationException();
89    }
90 
91    @Override
92    public IProbabilityDensityFunction getFourierTransform() throws FunctionNotInTimeDomainException {
93        throw new UnsupportedOperationException();
94    }
95 
96    @Override
97    public IProbabilityDensityFunction getInverseFourierTransform() throws FunctionNotInFrequencyDomainException {
98        throw new UnsupportedOperationException();
99    }
100 
101    @Override
102    public double getLowerDomainBorder() {
103        throw new UnsupportedOperationException();
104    }
105 
106    @Override
107    public double greaterThan(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException {
108        throw new UnsupportedOperationException();
109    }
110 
111    @Override
112    public double lessThan(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException {
113        throw new UnsupportedOperationException();
114    }
115 
116    @Override
117    public IProbabilityDensityFunction mult(IProbabilityDensityFunction pdf)
118            throws FunctionsInDifferenDomainsException, UnknownPDFTypeException, IncompatibleUnitsException {
119        throw new UnsupportedOperationException();
120    }
121 
122    @Override
123    public double probabilisticEquals(IProbabilityDensityFunction pdf) throws ProbabilityFunctionException {
124        throw new UnsupportedOperationException();
125    }
126 
127    @Override
128    public IProbabilityDensityFunction scale(double scalar) {
129        throw new UnsupportedOperationException();
130    }
131 
132    @Override
133    public IProbabilityDensityFunction shiftDomain(double scalar) throws DomainNotNumbersException {
134        throw new UnsupportedOperationException();
135    }
136 
137    @Override
138    public IProbabilityDensityFunction stretchDomain(double scalar) {
139        throw new UnsupportedOperationException();
140    }
141 
142    @Override
143    public IProbabilityDensityFunction sub(IProbabilityDensityFunction pdf) throws FunctionsInDifferenDomainsException,
144            UnknownPDFTypeException, IncompatibleUnitsException {
145        throw new UnsupportedOperationException();
146    }
147 
148    @Override
149    public void checkConstrains() throws NegativeDistanceException, ProbabilitySumNotOneException,
150            FunctionNotInTimeDomainException, UnitNotSetException, UnitNameNotSetException, InvalidSampleValueException {
151        throw new UnsupportedOperationException();
152    }
153 
154    @Override
155    public double getArithmeticMeanValue() throws DomainNotNumbersException, FunctionNotInTimeDomainException {
156        // this method has been implemented in accordance with [1]
157        return this.getDegreesOfFreedom();
158    }
159 
160    @Override
161    public Object getMedian() throws UnorderedDomainException {
162        // this method has been implemented in accordance with [1]
163        double intermediateResult = 1 - (2.0 / (9.0 * degreesOfFreedom));
164        return degreesOfFreedom * Math.pow(intermediateResult, 3);
165    }
166 
167    @Override
168    public Object getPercentile(int p) throws IndexOutOfBoundsException, UnorderedDomainException {
169        throw new UnsupportedOperationException();
170    }
171 
172    @Override
173    public boolean hasOrderedDomain() {
174        throw new UnsupportedOperationException();
175    }
176 
177}

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