1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.probfunction.math.impl; |
5 | |
6 | import de.uka.ipd.sdq.probfunction.math.IContinuousSample; |
7 | import de.uka.ipd.sdq.probfunction.math.util.MathTools; |
8 | |
9 | /** |
10 | * @author Ihssane |
11 | * |
12 | */ |
13 | public class ContinuousSampleImpl implements IContinuousSample { |
14 | |
15 | private Double value; |
16 | private Double probability; |
17 | /** |
18 | * @param value |
19 | * @param probability |
20 | */ |
21 | protected ContinuousSampleImpl(Double value, Double probability) { |
22 | this.value = value; |
23 | this.probability = probability; |
24 | } |
25 | /* |
26 | * (non-Javadoc) |
27 | * |
28 | * @see de.uka.ipd.sdq.math.probfunction.impl.IContinuousSampel#getProbability() |
29 | */ |
30 | public Double getProbability() { |
31 | return probability; |
32 | } |
33 | /* |
34 | * (non-Javadoc) |
35 | * |
36 | * @see de.uka.ipd.sdq.math.probfunction.impl.IContinuousSampel#setProbability(java.lang.Double) |
37 | */ |
38 | public void setProbability(Double probability) { |
39 | this.probability = probability; |
40 | } |
41 | /* |
42 | * (non-Javadoc) |
43 | * |
44 | * @see de.uka.ipd.sdq.math.probfunction.impl.IContinuousSampel#getValue() |
45 | */ |
46 | public double getValue() { |
47 | return value; |
48 | } |
49 | /* |
50 | * (non-Javadoc) |
51 | * |
52 | * @see de.uka.ipd.sdq.math.probfunction.impl.IContinuousSampel#setValue(java.lang.Double) |
53 | */ |
54 | public void setValue(Double value) { |
55 | this.value = value; |
56 | } |
57 | /** |
58 | * |
59 | */ |
60 | @Override |
61 | public boolean equals(Object obj) { |
62 | if (obj instanceof IContinuousSample) { |
63 | IContinuousSample s = (IContinuousSample) obj; |
64 | return MathTools.equalsDouble(this.getValue(), s.getValue()) |
65 | && MathTools.equalsDouble(this.getProbability(), s |
66 | .getProbability()); |
67 | } |
68 | return false; |
69 | } |
70 | |
71 | } |