| 1 | package de.uka.ipd.sdq.probespec.framework.matching; |
| 2 | |
| 3 | import javax.measure.quantity.Quantity; |
| 4 | |
| 5 | import de.uka.ipd.sdq.probespec.framework.ProbeSample; |
| 6 | import de.uka.ipd.sdq.probespec.framework.ProbeType; |
| 7 | |
| 8 | /** |
| 9 | * This MatchRule is able to decide whether the passed {@link ProbeSample} is of |
| 10 | * the specified probe type. |
| 11 | * |
| 12 | * @author pmerkle |
| 13 | * @see ProbeType |
| 14 | */ |
| 15 | public class ProbeTypeMatchRule implements IMatchRule { |
| 16 | |
| 17 | private ProbeType probeType; |
| 18 | |
| 19 | /** |
| 20 | * Class constructor specifying the probe type to match. |
| 21 | * |
| 22 | * @param probeType |
| 23 | * the probe type to match |
| 24 | */ |
| 25 | public ProbeTypeMatchRule(ProbeType probeType) { |
| 26 | super(); |
| 27 | this.probeType = probeType; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Checks whether the passed ProbeSample is of the probe type which has been |
| 32 | * passed using the constructor. |
| 33 | */ |
| 34 | @Override |
| 35 | public boolean match(ProbeSample<?, ? extends Quantity> sample) { |
| 36 | return sample.getProbeType().equals(probeType); |
| 37 | } |
| 38 | |
| 39 | } |