1 | package de.uka.ipd.sdq.sensorframework.filter; |
2 | |
3 | import java.util.Collection; |
4 | import java.util.Iterator; |
5 | |
6 | import de.uka.ipd.sdq.sensorframework.entities.Measurement; |
7 | import de.uka.ipd.sdq.sensorframework.filter.AbstractMeasurementsCollection; |
8 | |
9 | public class WarmupFilteredCollection extends |
10 | AbstractMeasurementsCollection { |
11 | |
12 | private long parameter; |
13 | |
14 | /** |
15 | * Initializes a new WarmupFilteredCollection with the given measurements and filter parameter. |
16 | * |
17 | * @param originalMeasurements |
18 | * The associated measurements. |
19 | * @param parameter The associated parameter |
20 | */ |
21 | public WarmupFilteredCollection( |
22 | Collection<Measurement> originalMeasurements, long parameter) { |
23 | super(originalMeasurements); |
24 | this.parameter = parameter; |
25 | } |
26 | |
27 | /** {@inheritDoc} |
28 | */ |
29 | @Override |
30 | protected void applyFilter(Collection<Measurement> filteredItemsList) { |
31 | Iterator<Measurement> it = originalMeasurements.iterator(); |
32 | |
33 | for (int i = 0; i < originalMeasurements.size() |
34 | && i < parameter; i++) { |
35 | Measurement m = it.next(); |
36 | filteredItemsList.add(m); |
37 | } |
38 | } |
39 | } |