Blame view

src/mior/model/dist/PoissonDistribution.java 757 Bytes
89f70c1ec   glaville   import current mc...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  package mior.model.dist;
  
  public class PoissonDistribution extends AbstractMiorDistribution {
  	
  	private final int minOM;
  	private final int maxOM;
  	private final double lambda;
  	
  	public PoissonDistribution(int meanMM, int meanOM, double variation) {
  		super(meanMM, meanOM);
  		minOM = (int) ((1.0 - variation) * meanOM);
  		maxOM = (int) ((1.0 + variation) * meanOM);
  		this.lambda = (maxOM - minOM) / 2.0;
  	}
  	
  	@Override
  	public double getFactor() {
  		throw new UnsupportedOperationException();
  		/*final double L = Math.exp(-lambda);
  		int k = 0;
  		double p = 1;
  		
  		do {
  			k += 1;
  			p *= Math.random();
  		} while (p > L);
  		
  		return (minOM + k);*/
  	}
  	
  	@Override
  	public double getMaxFactor() {
  		throw new UnsupportedOperationException();
  	}
  	
  }