ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / 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.linuxtools.tmf.core.event.matching;
14
15 import java.util.Collection;
16
17 import org.eclipse.linuxtools.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
42 @Override
43 public void init(Collection<ITmfTrace> fTraces) {
44 fMatchCount = 0;
45 }
46
47 @Override
48 public void addMatch(TmfEventDependency match) {
49 fMatchCount++;
50 }
51
52 @Override
53 public void matchingEnded() {
54
55 }
56
57 @Override
58 public int countMatches() {
59 return fMatchCount;
60 }
61
62 /**
63 * Returns the match at the specified index
64 *
65 * @param index
66 * The index of the match to get
67 * @return The match at index or null or not present
68 * @deprecated Matches are not kept anymore, they use up memory for no real reason
69 */
70 @Deprecated
71 public TmfEventDependency getMatch(int index) {
72 return null;
73 }
74
75 @Override
76 public String toString() {
77 return getClass().getSimpleName() + " [ Number of matches found: " + fMatchCount + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
78 }
79
80 }
This page took 0.053969 seconds and 5 git commands to generate.