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 "not equals" for different kinds of operands. |
7 | * @author koziolek |
8 | */ |
9 | public class NotEqualOperation extends CompareOperation { |
10 | |
11 | protected IProbabilityMassFunction getComparePMF(boolean left, boolean right) { |
12 | if (left != right) |
13 | return getBoolPMF(1.0); |
14 | else |
15 | return getBoolPMF(0.0); |
16 | } |
17 | |
18 | public IProbabilityMassFunction getComparePMF(double left, double right) { |
19 | if (left != right) |
20 | return getBoolPMF(1.0); |
21 | else |
22 | return getBoolPMF(0.0); |
23 | } |
24 | |
25 | public IProbabilityMassFunction getComparePMF(double left, IProbabilityMassFunction right) { |
26 | return compare(right, left); |
27 | } |
28 | |
29 | public IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, double right) { |
30 | return getBoolPMF(1-getProbabilityForValue(left, right)); |
31 | } |
32 | |
33 | public IProbabilityMassFunction getComparePMF(IProbabilityMassFunction left, IProbabilityMassFunction right) { |
34 | return getBoolPMF(comparePointWise(left, right, this)); |
35 | } |
36 | |
37 | public IProbabilityMassFunction getComparePMF(String left, IProbabilityMassFunction right) { |
38 | throw new UnsupportedOperationException(); |
39 | } |
40 | |
41 | public IProbabilityMassFunction getComparePMF(String left, String right) { |
42 | if (left.equals(right)) |
43 | return getBoolPMF(0.0); |
44 | else |
45 | return getBoolPMF(1.0); |
46 | } |
47 | } |