2010-11-09 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / event / TmfEventReference.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>TmfEventReference</u></b>
17 * <p>
18 * An application-defined event reference.
19 */
1a971e96 20public class TmfEventReference implements Cloneable {
8c8bf09f 21
cbd4ad82 22 // ------------------------------------------------------------------------
8c8bf09f 23 // Attributes
cbd4ad82 24 // ------------------------------------------------------------------------
8c8bf09f 25
28b94d61 26 protected Object fReference;
8c8bf09f 27
cbd4ad82 28 // ------------------------------------------------------------------------
8c8bf09f 29 // Constructors
cbd4ad82 30 // ------------------------------------------------------------------------
8c8bf09f 31
28b94d61 32 /**
cbd4ad82 33 * The default constructor
28b94d61
FC
34 */
35 public TmfEventReference() {
cbd4ad82 36 fReference = null;
28b94d61
FC
37 }
38
8c8bf09f 39 /**
cbd4ad82 40 * @param reference the event reference
8c8bf09f
ASL
41 */
42 public TmfEventReference(Object reference) {
43 fReference = reference;
44 }
45
28b94d61 46 /**
cbd4ad82
FC
47 * Copy constructor
48 * @param other the original event reference
28b94d61
FC
49 */
50 public TmfEventReference(TmfEventReference other) {
cbd4ad82
FC
51 if (other == null)
52 throw new IllegalArgumentException();
53 TmfEventReference o = (TmfEventReference) other;
54 fReference = o.fReference;
28b94d61
FC
55 }
56
cbd4ad82 57 // ------------------------------------------------------------------------
8c8bf09f 58 // Accessors
cbd4ad82 59 // ------------------------------------------------------------------------
8c8bf09f
ASL
60
61 /**
cbd4ad82 62 * @return the event reference
8c8bf09f 63 */
28b94d61 64 public Object getReference() {
8c8bf09f
ASL
65 return fReference;
66 }
1f506a43 67
cbd4ad82
FC
68 // ------------------------------------------------------------------------
69 // Object
70 // ------------------------------------------------------------------------
1f506a43 71
cbd4ad82
FC
72 @Override
73 public int hashCode() {
74 return (fReference != null) ? fReference.hashCode() : 0;
28b94d61
FC
75 }
76
cbd4ad82 77 @Override
3b38ea61 78 @SuppressWarnings("nls")
1f506a43 79 public String toString() {
28b94d61 80 return "[TmfEventReference(" + ((fReference != null) ? fReference.toString() : "null") + ")]";
1f506a43
FC
81 }
82
cbd4ad82
FC
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
1a971e96
FC
91 @Override
92 public TmfEventReference clone() {
93 TmfEventReference clone = null;
94 try {
95 clone = (TmfEventReference) super.clone();
96 clone.fReference = null;
97 }
98 catch (CloneNotSupportedException e) {
99 e.printStackTrace();
100 }
101 return clone;
102 }
8c8bf09f 103}
This page took 0.030649 seconds and 5 git commands to generate.