Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / linuxtools / tmf / core / event / matching / TmfEventMatches.java
CommitLineData
e73a4ba5
GB
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
13package org.eclipse.linuxtools.tmf.core.event.matching;
14
27213c57 15import java.util.Collection;
e73a4ba5
GB
16
17import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
18
19/**
20 * Class that does something with a match.
21 *
b0355e3f 22 * This default implementation of the class just counts the matches
e73a4ba5
GB
23 *
24 * @author Geneviève Bastien
25 * @since 3.0
26 */
27public class TmfEventMatches implements IMatchProcessingUnit {
28
b0355e3f 29 private int fMatchCount;
e73a4ba5
GB
30
31 /**
32 * Constructor
33 */
34 public TmfEventMatches() {
b0355e3f 35 fMatchCount = 0;
e73a4ba5
GB
36 }
37
38 /**
39 * IMatchProcessingUnit overrides
40 */
41
42 @Override
27213c57 43 public void init(Collection<ITmfTrace> fTraces) {
b0355e3f 44 fMatchCount = 0;
e73a4ba5
GB
45 }
46
47 @Override
48 public void addMatch(TmfEventDependency match) {
b0355e3f 49 fMatchCount++;
e73a4ba5
GB
50 }
51
52 @Override
53 public void matchingEnded() {
54
55 }
56
57 @Override
58 public int countMatches() {
b0355e3f 59 return fMatchCount;
e73a4ba5
GB
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
b0355e3f 68 * @deprecated Matches are not kept anymore, they use up memory for no real reason
e73a4ba5 69 */
b0355e3f 70 @Deprecated
e73a4ba5 71 public TmfEventDependency getMatch(int index) {
b0355e3f 72 return null;
e73a4ba5
GB
73 }
74
75 @Override
76 public String toString() {
b0355e3f 77 return getClass().getSimpleName() + " [ Number of matches found: " + fMatchCount + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
e73a4ba5
GB
78 }
79
80}
This page took 0.043451 seconds and 5 git commands to generate.