Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 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 | * William Bourque (wbourque@gmail.com) - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.lttng.event; | |
14 | ||
15 | import org.eclipse.linuxtools.tmf.event.*; | |
16 | ||
17 | /** | |
07d9e2ee FC |
18 | * <b><u>LttngEventReference</u></b><p> |
19 | * | |
5d10d135 ASL |
20 | * Lttng specific implementation of the TmfEventReference |
21 | */ | |
22 | public class LttngEventReference extends TmfEventReference { | |
23 | ||
07d9e2ee | 24 | private String tracename = ""; |
5d10d135 ASL |
25 | |
26 | /** | |
07d9e2ee | 27 | * Constructor with parameters.<p> |
5d10d135 | 28 | * |
28b94d61 FC |
29 | * @param newTraceName Trace name |
30 | */ | |
31 | public LttngEventReference(String newTraceName) { | |
32 | super(""); | |
33 | tracename = newTraceName; | |
34 | } | |
35 | ||
36 | /** | |
37 | * Constructor with parameters with optional tracefile path.<p> | |
38 | * | |
07d9e2ee | 39 | * @param newTracefilePath Complete tracefile path |
28b94d61 | 40 | * @param newTraceName Trace name |
5d10d135 | 41 | */ |
07d9e2ee | 42 | public LttngEventReference(String newTracefilePath, String newTraceName) { |
5d10d135 ASL |
43 | super(newTracefilePath); |
44 | ||
07d9e2ee FC |
45 | // Save the name of the trace |
46 | tracename = newTraceName; | |
5d10d135 ASL |
47 | } |
48 | ||
3fbd810a | 49 | /** |
07d9e2ee | 50 | * Copy Constructor.<p> |
3fbd810a | 51 | * |
07d9e2ee | 52 | * @param oldReference LttngEventReference to copy from. |
3fbd810a FC |
53 | */ |
54 | public LttngEventReference(LttngEventReference oldReference) { | |
55 | this( oldReference.getValue().toString(), oldReference.getTracepath() ); | |
56 | } | |
57 | ||
5d10d135 ASL |
58 | |
59 | public String getTracepath() { | |
07d9e2ee | 60 | return tracename; |
5d10d135 | 61 | } |
3fbd810a | 62 | |
07d9e2ee FC |
63 | public void setTracepath(String tracename) { |
64 | this.tracename = tracename; | |
5d10d135 ASL |
65 | } |
66 | ||
28b94d61 FC |
67 | public String getValue() { |
68 | return (String)fReference; | |
69 | } | |
70 | ||
71 | public void setValue(String newReference) { | |
72 | fReference = newReference; | |
73 | } | |
74 | ||
07d9e2ee FC |
75 | /** |
76 | * toString() method.<p> | |
77 | * | |
28b94d61 FC |
78 | * We return only tracename, as it will be used directly in the eventsView. |
79 | * Returning only tracename gives a better output. | |
07d9e2ee FC |
80 | * |
81 | * @return tracename as String | |
82 | */ | |
3fbd810a FC |
83 | @Override |
84 | public String toString() { | |
07d9e2ee | 85 | return tracename; |
3fbd810a FC |
86 | } |
87 | ||
1a971e96 FC |
88 | @Override |
89 | public LttngEventReference clone() { | |
90 | LttngEventReference clone = (LttngEventReference) super.clone(); | |
91 | clone.fReference = new String((String) fReference); | |
92 | clone.tracename = new String((String) tracename); | |
93 | return clone; | |
94 | } | |
5d10d135 | 95 | } |