1 | package de.uka.ipd.sdq.simucomframework.variables.functions; |
2 | |
3 | import java.util.List; |
4 | |
5 | |
6 | import de.uka.ipd.sdq.probfunction.math.INormalDistribution; |
7 | import de.uka.ipd.sdq.probfunction.math.IPDFFactory; |
8 | import de.uka.ipd.sdq.probfunction.math.IRandomGenerator; |
9 | import de.uka.ipd.sdq.simucomframework.variables.converter.NumberConverter; |
10 | |
11 | public class NormDistFunction extends AbstractProbDistFunction { |
12 | |
13 | |
14 | public NormDistFunction(IRandomGenerator random, IPDFFactory factory) { |
15 | super(random, factory); |
16 | } |
17 | |
18 | public boolean checkParameters(List<Object> parameters) { |
19 | if (parameters.size() != 2) |
20 | return false; |
21 | return true; |
22 | } |
23 | |
24 | public Object evaluate(List<Object> parameters) { |
25 | double mean = NumberConverter.toDouble(parameters.get(0)); |
26 | double deviation = NumberConverter.toDouble(parameters.get(1)); |
27 | INormalDistribution distribution = factory.createNormalDistribution(mean, deviation); |
28 | return distribution.inverseF(randomGen.random()); |
29 | } |
30 | |
31 | } |