1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.probfunction.math.apache.impl; |
5 | |
6 | |
7 | import de.uka.ipd.sdq.probfunction.math.IBinomialDistribution; |
8 | import de.uka.ipd.sdq.probfunction.math.IChiSquareDistribution; |
9 | import de.uka.ipd.sdq.probfunction.math.IPDFFactory; |
10 | import de.uka.ipd.sdq.probfunction.math.IExponentialDistribution; |
11 | import de.uka.ipd.sdq.probfunction.math.IGammaDistribution; |
12 | import de.uka.ipd.sdq.probfunction.math.ILognormalDistribution; |
13 | import de.uka.ipd.sdq.probfunction.math.INormalDistribution; |
14 | import de.uka.ipd.sdq.probfunction.math.IPoissonDistribution; |
15 | import de.uka.ipd.sdq.probfunction.math.IStudentTDistribution; |
16 | import de.uka.ipd.sdq.probfunction.math.IUniformDistribution; |
17 | import de.uka.ipd.sdq.probfunction.math.IUniformIntDistribution; |
18 | |
19 | /** |
20 | * @author joerg |
21 | * |
22 | */ |
23 | public class PDFFactory implements IPDFFactory{ |
24 | |
25 | /* (non-Javadoc) |
26 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createExponentialDistribution(double) |
27 | */ |
28 | @Override |
29 | public IExponentialDistribution createExponentialDistribution(double rate) { |
30 | return new ExponentialDistribution(rate); |
31 | } |
32 | |
33 | /* (non-Javadoc) |
34 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createGammaDistribution(double, double) |
35 | */ |
36 | @Override |
37 | public IGammaDistribution createGammaDistribution(double alpha, double theta) { |
38 | return new GammaDistribution(alpha, theta); |
39 | } |
40 | |
41 | /* (non-Javadoc) |
42 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createLognormalDistribution(double, double) |
43 | */ |
44 | @Override |
45 | public ILognormalDistribution createLognormalDistribution(double mu, double sigma) { |
46 | return new LognormalDistribution(mu, sigma); |
47 | } |
48 | |
49 | /* (non-Javadoc) |
50 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createNormalDistribution(double, double) |
51 | */ |
52 | @Override |
53 | public INormalDistribution createNormalDistribution(double mu, double sigma) { |
54 | return new NormalDistribution(mu, sigma); |
55 | } |
56 | |
57 | /* (non-Javadoc) |
58 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createNormalDistribution(double, double) |
59 | */ |
60 | @Override |
61 | public IGammaDistribution createGammaDistributionFromMoments(double mean, |
62 | double coeffVar) { |
63 | |
64 | return new GammaDistributionFromMoments(mean, coeffVar); |
65 | } |
66 | |
67 | /* (non-Javadoc) |
68 | * @see de.uka.ipd.sdq.probfunction.math.impl.IContinousPDFFactory#createNormalDistribution(double, double) |
69 | */ |
70 | @Override |
71 | public ILognormalDistribution createLognormalDistributionFromMoments( |
72 | double mean, double variance) { |
73 | |
74 | return new LognormalDistributionFromMoments(mean, variance); |
75 | } |
76 | |
77 | @Override |
78 | public IBinomialDistribution createBinomialDistribution(int trials, |
79 | double probability) { |
80 | |
81 | return new BinomialDistribution(trials, probability); |
82 | } |
83 | |
84 | @Override |
85 | public IPoissonDistribution createPoissonDistribution(double mean) { |
86 | |
87 | return new PoissonDistribution(mean); |
88 | } |
89 | |
90 | @Override |
91 | public IUniformIntDistribution createUniformIntDistribution(int a, int b) { |
92 | |
93 | return new UniformIntDistribution(a, b); |
94 | } |
95 | |
96 | @Override |
97 | public IUniformDistribution createUniformDistribution(double a, double b) { |
98 | |
99 | return new UniformDistribution(a, b); |
100 | } |
101 | |
102 | @Override |
103 | public IChiSquareDistribution createChiSquareDistribution(int degreesOfFreedom) { |
104 | return new ChiSquareDistribution(degreesOfFreedom); |
105 | } |
106 | |
107 | @Override |
108 | public IStudentTDistribution createStudentTDistribution(int degreesOfFreedom) { |
109 | return new StudentTDistribution(degreesOfFreedom); |
110 | } |
111 | |
112 | } |