common: Generalize the BufferedBlockingQueue's concurrent test
[deliverable/tracecompass.git] / org.eclipse.tracecompass.btf.core / src / org / eclipse / tracecompass / btf / core / event / BtfEvent.java
1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 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 * Patrick Tasse - Rename reference to target
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.btf.core.event;
15
16 import org.eclipse.core.runtime.Platform;
17 import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
18 import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
19 import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
20 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
21 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
22
23 /**
24 * A Btf event, basically a wrapper for the TmfEvent with the additional fields
25 * source, target and description.
26 *
27 * @author Matthew Khouzam
28 */
29 public class BtfEvent extends TmfEvent {
30
31 private final String fDescription;
32 private final String fSource;
33 private final String fTarget;
34
35 /**
36 * Standard constructor.
37 *
38 * @param trace
39 * the parent trace
40 * @param rank
41 * the event rank
42 * @param timestamp
43 * the event timestamp
44 * @param source
45 * the event source
46 * @param type
47 * the event type
48 * @param description
49 * a description of the type
50 * @param content
51 * the event content (payload)
52 * @param target
53 * the event reference
54 */
55 public BtfEvent(final ITmfTrace trace,
56 final long rank,
57 final ITmfTimestamp timestamp,
58 final String source,
59 final ITmfEventType type,
60 final String description,
61 final ITmfEventField content,
62 final String target) {
63 super(trace, rank, timestamp, type, content);
64 fDescription = description;
65 fSource = source;
66 fTarget = target;
67 }
68
69 /**
70 * Gets a description
71 *
72 * @return the description
73 */
74 public String getEventDescription() {
75 return fDescription;
76 }
77
78 @Override
79 public Object getAdapter(Class adapter) {
80 // Force loading the adapters otherwise some plugins might not load
81 return Platform.getAdapterManager().loadAdapter(this, adapter.getName());
82 }
83
84 /**
85 * Returns the source of this event.
86 *
87 * @return This event's source
88 */
89 public String getSource() {
90 return fSource;
91 }
92
93 /**
94 * Returns the target of this event.
95 *
96 * @return This event's target
97 */
98 public String getTarget() {
99 return fTarget;
100 }
101 }
This page took 0.035928 seconds and 5 git commands to generate.