1 16 17 package org.apache.commons.math.distribution; 18 19 import org.apache.commons.discovery.tools.DiscoverClass; 20 21 47 public abstract class DistributionFactory { 48 51 protected DistributionFactory() { 52 super(); 53 } 54 55 59 public static DistributionFactory newInstance() { 60 DistributionFactory factory = null; 61 try { 62 DiscoverClass dc = new DiscoverClass(); 63 factory = (DistributionFactory) dc.newInstance( 64 DistributionFactory.class, 65 "org.apache.commons.math.distribution.DistributionFactoryImpl"); 66 } catch(Throwable t) { 67 return new DistributionFactoryImpl(); 68 } 69 return factory; 70 } 71 72 80 public abstract BinomialDistribution createBinomialDistribution( 81 int numberOfTrials, double probabilityOfSuccess); 82 83 90 public CauchyDistribution createCauchyDistribution( 91 double median, double scale) 92 { 93 return new CauchyDistributionImpl(median, scale); 94 } 95 96 102 public abstract ChiSquaredDistribution createChiSquareDistribution( 103 double degreesOfFreedom); 104 105 111 public abstract ExponentialDistribution createExponentialDistribution( 112 double mean); 113 114 121 public abstract FDistribution createFDistribution( 122 double numeratorDegreesOfFreedom, double denominatorDegreesOfFreedom); 123 124 133 public abstract GammaDistribution createGammaDistribution( 134 double alpha, double beta); 135 136 142 public abstract TDistribution createTDistribution(double degreesOfFreedom); 143 144 153 public abstract HypergeometricDistribution 154 createHypergeometricDistribution(int populationSize, 155 int numberOfSuccesses, int sampleSize); 156 157 165 public abstract NormalDistribution 166 createNormalDistribution(double mean, double sd); 167 168 174 public abstract NormalDistribution createNormalDistribution(); 175 176 182 public abstract PoissonDistribution 183 createPoissonDistribution(double lambda); 184 185 194 public WeibullDistribution createWeibullDistribution( 195 double alpha, double beta) 196 { 197 return new WeibullDistributionImpl(alpha, beta); 198 } 199 } 200 | Popular Tags |