tmf: Switch tmf.core to Java 7 + fix warnings
[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.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
19
20 /**
21 * Class that does something with a match.
22 *
23 * This default implementation of the class just adds it to a list of matches
24 *
25 * @author Geneviève Bastien
26 * @since 3.0
27 */
28 public class TmfEventMatches implements IMatchProcessingUnit {
29
30 /**
31 * The list of matches found
32 */
33 private final List<TmfEventDependency> fMatches;
34
35 /**
36 * Constructor
37 */
38 public TmfEventMatches() {
39 fMatches = new ArrayList<>();
40 }
41
42 /**
43 * IMatchProcessingUnit overrides
44 */
45
46 @Override
47 public void init(ITmfTrace[] fTraces) {
48
49 }
50
51 @Override
52 public void addMatch(TmfEventDependency match) {
53 fMatches.add(match);
54 }
55
56 @Override
57 public void matchingEnded() {
58
59 }
60
61 @Override
62 public int countMatches() {
63 return fMatches.size();
64 }
65
66 /**
67 * Returns the match at the specified index
68 *
69 * @param index
70 * The index of the match to get
71 * @return The match at index or null or not present
72 */
73 public TmfEventDependency getMatch(int index) {
74 return fMatches.get(index);
75 }
76
77 @Override
78 public String toString() {
79 return getClass().getSimpleName() + " [ Number of matches found: " + fMatches.size() + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
80 }
81
82 }
This page took 0.032565 seconds and 5 git commands to generate.