Revert "Fix for bug 381411: Implement ranked location in experiment."
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / component / TmfComponent.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.core.component;
14
15 import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
16 import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
17
18 /**
19 * This is the base class of the TMF components.
20 * <p>
21 * Currently, it only addresses the inter-component signaling.
22 *
23 * @version 1.0
24 * @author Francois Chouinard
25 */
26 public abstract class TmfComponent implements ITmfComponent {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 private String fName;
33
34 // ------------------------------------------------------------------------
35 // Constructor
36 // ------------------------------------------------------------------------
37
38 /**
39 * Default constructor. To be used in conjunction with init()
40 */
41 public TmfComponent() {
42 this(""); //$NON-NLS-1$
43 }
44
45 /**
46 * Perform component initialization and register it as a signal listener.
47 * Need to be called when the default constructor was used.
48 *
49 * @param name the component name
50 */
51 public void init(String name) {
52 fName = name;
53 TmfSignalManager.register(this);
54 }
55
56 /**
57 * The standard constructor
58 *
59 * @param name the component name
60 */
61 public TmfComponent(String name) {
62 init(name);
63 }
64
65 /**
66 * The copy constructor
67 *
68 * @param other the other component
69 */
70 public TmfComponent(TmfComponent other) {
71 init(other.fName);
72 }
73
74 // ------------------------------------------------------------------------
75 // Getters/setters
76 // ------------------------------------------------------------------------
77
78 /* (non-Javadoc)
79 * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#getName()
80 */
81 @Override
82 public String getName() {
83 return fName;
84 }
85
86 /**
87 * @param name the new component name
88 */
89 protected void setName(String name) {
90 fName = name;
91 }
92
93 // ------------------------------------------------------------------------
94 // ITmfComponent
95 // ------------------------------------------------------------------------
96
97 /* (non-Javadoc)
98 * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#dispose()
99 */
100 @Override
101 public void dispose() {
102 TmfSignalManager.deregister(this);
103 // if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "terminated");
104 }
105
106 /* (non-Javadoc)
107 * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.core.signal.TmfSignal)
108 */
109 @Override
110 public void broadcast(TmfSignal signal) {
111 TmfSignalManager.dispatchSignal(signal);
112 }
113
114 }
This page took 0.033975 seconds and 5 git commands to generate.