TMF: Synchronize an experiment instead of collection of traces
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / event / matching / TmfEventMatches.java
1 /*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Geneviève Bastien - Initial implementation and API
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.core.event.matching;
14
15 import java.util.Collection;
16
17 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
18
19 /**
20 * Class that does something with a match.
21 *
22 * This default implementation of the class just counts the matches
23 *
24 * @author Geneviève Bastien
25 * @since 3.0
26 */
27 public class TmfEventMatches implements IMatchProcessingUnit {
28
29 private int fMatchCount;
30
31 /**
32 * Constructor
33 */
34 public TmfEventMatches() {
35 fMatchCount = 0;
36 }
37
38 /**
39 * IMatchProcessingUnit overrides
40 */
41 @Override
42 public void init(Collection<ITmfTrace> fTraces) {
43 fMatchCount = 0;
44 }
45
46 @Override
47 public void addMatch(TmfEventDependency match) {
48 fMatchCount++;
49 }
50
51 @Override
52 public void matchingEnded() {
53
54 }
55
56 @Override
57 public int countMatches() {
58 return fMatchCount;
59 }
60
61 /**
62 * Returns the match at the specified index
63 *
64 * @param index
65 * The index of the match to get
66 * @return The match at index or null or not present
67 * @deprecated Matches are not kept anymore, they use up memory for no real reason
68 */
69 @Deprecated
70 public TmfEventDependency getMatch(int index) {
71 return null;
72 }
73
74 @Override
75 public String toString() {
76 return getClass().getSimpleName() + " [ Number of matches found: " + fMatchCount + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
77 }
78
79 }
This page took 0.05705 seconds and 5 git commands to generate.