blob: 97db54ca612afde6fb3df741d048509c838076fe (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
|
package org.singinst.uf.model;
import java.awt.Color;
import org.singinst.uf.math.MathUtil;
public class CumulativeNormalDistributionCalculation extends Calculation {
private final Evaluable mean;
private final Evaluable stdDev;
private final double x;
private final Color color;
/**
*
* @param description
* @param mean
* @param stdDev
* @param x
* @param display
* The color to display the result of this calculation.
*/
public CumulativeNormalDistributionCalculation(String description, Evaluable mean, Evaluable stdDev, double x, Color display) {
super(description, false);
this.mean = mean;
this.stdDev = stdDev;
this.x = x;
this.color = display;
}
@Override
public double rawEvaluate(StringBuilder htmlConsole) {
StringBuilder nullBuilder = new StringBuilder();
double meanValue = mean.evaluate(nullBuilder);
double stdDevValue = stdDev.evaluate(nullBuilder);
double retVal = MathUtil.cumulativeNormalDistribution(
meanValue, stdDevValue, x);
//htmlConsole.append("Cumulative probability (mean = " + meanValue + "; stddev = " + stdDevValue + ") of " + getDescription() + " at " + x);
htmlConsole.append(getDescription().replace("\'", ""));
return retVal;
}
@Override
public Color getColor(){
return color;
}
}
|