| 1 | package de.uka.ipd.sdq.stoex.analyser.operations; |
| 2 | |
| 3 | import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction; |
| 4 | import de.uka.ipd.sdq.probfunction.math.IProbabilityMassFunction; |
| 5 | import de.uka.ipd.sdq.probfunction.math.exception.DomainNotNumbersException; |
| 6 | |
| 7 | /** |
| 8 | * Implements the operation "modulo" for different kinds of operands. |
| 9 | * Note, that so far only integers and doubles are supported. |
| 10 | * @author koziolek |
| 11 | */ |
| 12 | public class ModOperation extends TermProductOperation { |
| 13 | |
| 14 | @Override |
| 15 | public double compute(double left, double right) { |
| 16 | return left % right; |
| 17 | } |
| 18 | |
| 19 | @Override |
| 20 | public int compute(int left, int right) { |
| 21 | return left % right; |
| 22 | } |
| 23 | |
| 24 | @Override |
| 25 | public IProbabilityMassFunction compute(IProbabilityMassFunction left, |
| 26 | double right) { |
| 27 | //TODO |
| 28 | //return left.mod(right); |
| 29 | throw new UnsupportedOperationException(); |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | public IProbabilityDensityFunction compute(IProbabilityDensityFunction left, double right) throws DomainNotNumbersException { |
| 34 | throw new UnsupportedOperationException(); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | protected Double calculateOperationForValues(Double value1, Double value2) { |
| 39 | return value1 % value2; |
| 40 | } |
| 41 | |
| 42 | } |