Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / event / TmfEventSource.java
CommitLineData
8c8bf09f
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:
1f506a43 10 * Francois Chouinard - Initial API and implementation
8c8bf09f
ASL
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.event;
14
15/**
16 * <b><u>TmfEventSource</u></b>
17 * <p>
18 * The event source.
19 */
1a971e96 20public class TmfEventSource implements Cloneable {
8c8bf09f 21
cbd4ad82 22 // ------------------------------------------------------------------------
8c8bf09f 23 // Attributes
cbd4ad82 24 // ------------------------------------------------------------------------
8c8bf09f 25
28b94d61 26 protected Object fSourceId;
8c8bf09f 27
cbd4ad82 28 // ------------------------------------------------------------------------
8c8bf09f 29 // Constructors
cbd4ad82 30 // ------------------------------------------------------------------------
8c8bf09f
ASL
31
32 /**
cbd4ad82 33 * The default constructor
8c8bf09f
ASL
34 */
35 public TmfEventSource() {
cbd4ad82 36 fSourceId = null;
8c8bf09f
ASL
37 }
38
39 /**
40 * @param sourceId
41 */
42 public TmfEventSource(Object sourceId) {
43 fSourceId = sourceId;
44 }
45
28b94d61 46 /**
cbd4ad82 47 * Copy constructor
28b94d61
FC
48 * @param other
49 */
50 public TmfEventSource(TmfEventSource other) {
cbd4ad82
FC
51 if (other == null)
52 throw new IllegalArgumentException();
53 TmfEventSource o = (TmfEventSource) other;
54 fSourceId = o.fSourceId;
28b94d61
FC
55 }
56
cbd4ad82 57 // ------------------------------------------------------------------------
8c8bf09f 58 // Accessors
cbd4ad82 59 // ------------------------------------------------------------------------
8c8bf09f
ASL
60
61 /**
62 * @return
63 */
64 public Object getSourceId() {
65 return fSourceId;
66 }
1f506a43 67
cbd4ad82
FC
68 // ------------------------------------------------------------------------
69 // Object
70 // ------------------------------------------------------------------------
1f506a43 71
28b94d61 72 @Override
cbd4ad82
FC
73 public int hashCode() {
74 return (fSourceId != null) ? fSourceId.hashCode() : 0;
75 }
76
77 @Override
78 public boolean equals(Object other) {
79 if (!(other instanceof TmfEventSource))
80 return false;
81 TmfEventSource o = (TmfEventSource) other;
82 return fSourceId.equals(o.fSourceId);
83 }
28b94d61
FC
84
85 @Override
3b38ea61 86 @SuppressWarnings("nls")
1f506a43 87 public String toString() {
28b94d61 88 return "[TmfEventSource(" + ((fSourceId != null) ? fSourceId.toString() : "null") + ")]";
1f506a43
FC
89 }
90
1a971e96
FC
91 @Override
92 public TmfEventSource clone() {
93 TmfEventSource clone = null;
94 try {
95 clone = (TmfEventSource) super.clone();
c87f4702 96 clone.fSourceId = fSourceId;
1a971e96
FC
97 }
98 catch (CloneNotSupportedException e) {
99 e.printStackTrace();
100 }
101 return clone;
102 }
8c8bf09f 103}
This page took 0.032174 seconds and 5 git commands to generate.