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