1 | package de.uka.ipd.sdq.stoex.analyser.operations; |
2 | |
3 | import de.uka.ipd.sdq.probfunction.math.IProbabilityMassFunction; |
4 | |
5 | /** |
6 | * Implements the operation "less equal" for different kinds of operands. |
7 | * @author koziolek |
8 | */ |
9 | public class LessEqualOperation extends CompareOperation { |
10 | |
11 | protected IProbabilityMassFunction getComparePMF(boolean left, boolean right) { |
12 | throw new UnsupportedOperationException(); |
13 | } |
14 | |
15 | protected IProbabilityMassFunction getComparePMF(double left, double right) { |
16 | if (left <= right) |
17 | return getBoolPMF(1.0); |
18 | else |
19 | return getBoolPMF(0.0); |
20 | } |
21 | |
22 | protected IProbabilityMassFunction getComparePMF(double left, IProbabilityMassFunction right) { |
23 | return new GreaterEqualOperation().compare(right, left); |
24 | } |
25 | |
26 | protected IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, double right) { |
27 | return getBoolPMF(getThresholdProbability(left, right, true)); |
28 | } |
29 | |
30 | protected IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, |
31 | IProbabilityMassFunction right) { |
32 | return getBoolPMF(comparePointWise(left, right, this)); |
33 | } |
34 | |
35 | protected IProbabilityMassFunction getComparePMF(String left, |
36 | IProbabilityMassFunction right) { |
37 | throw new UnsupportedOperationException(); |
38 | } |
39 | |
40 | protected IProbabilityMassFunction getComparePMF(String left, String right) { |
41 | throw new UnsupportedOperationException(); |
42 | } |
43 | |
44 | } |