Commit | Line | Data |
---|---|---|
409bea20 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made 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 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.trace; |
409bea20 GB |
14 | |
15 | import java.util.HashSet; | |
16 | import java.util.Set; | |
17 | ||
2bdf0193 | 18 | import org.eclipse.tracecompass.tmf.core.event.ITmfEventType; |
409bea20 GB |
19 | |
20 | /** | |
21 | * Set Helper for sets of ITmfTraceType | |
22 | * | |
23 | * TODO Remove once Java 8 is used (replace with Streams) | |
24 | * | |
25 | * @author Matthew Khouzam | |
409bea20 GB |
26 | */ |
27 | public final class TmfEventTypeCollectionHelper { | |
28 | ||
29 | private TmfEventTypeCollectionHelper() { | |
30 | } | |
31 | ||
32 | /** | |
33 | * Gets the event names from a collection of event types | |
34 | * | |
35 | * @param eventTypes | |
36 | * an iterable collection of ITmfEventTypes | |
37 | * @return a set of the names of these events, if some names are clashing | |
38 | * they will only appear once | |
39 | */ | |
e600c338 | 40 | public static Set<String> getEventNames(Iterable<? extends ITmfEventType> eventTypes) { |
409bea20 GB |
41 | Set<String> retSet = new HashSet<>(); |
42 | for (ITmfEventType eventType : eventTypes) { | |
43 | retSet.add(eventType.getName()); | |
44 | } | |
45 | return retSet; | |
46 | } | |
47 | } |