ctf.core: remove deprecated code
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.tmf.ctf.core / src / org / eclipse / tracecompass / tmf / ctf / core / event / lookup / CtfTmfCallsite.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * 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 * Patrick Tasse - Initial API and implementation
11 * Bernd Hufmann - Updated for new parent class
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.tmf.ctf.core.event.lookup;
15
16 import java.util.Objects;
17
18 import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
19 import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite;
20
21 /**
22 * CTF TMF call site information for source code lookup.
23 *
24 * @author Patrick Tasse
25 * @since 3.0
26 */
27 public class CtfTmfCallsite extends TmfCallsite {
28
29 // ------------------------------------------------------------------------
30 // Attributes
31 // ------------------------------------------------------------------------
32
33 /** The event name. */
34 private final String fEventName;
35
36 /** The instruction pointer. */
37 private final long fInstructionPointer;
38
39 // ------------------------------------------------------------------------
40 // Constructors
41 // ------------------------------------------------------------------------
42
43 /**
44 * Standard Constructor.
45 *
46 * @param callsite
47 * - a CTF call site
48 */
49 public CtfTmfCallsite(CTFCallsite callsite) {
50 super(callsite.getFileName(), callsite.getLineNumber());
51 fEventName = callsite.getEventName();
52 fInstructionPointer = callsite.getIp();
53 }
54
55 // ------------------------------------------------------------------------
56 // Accessors
57 // ------------------------------------------------------------------------
58
59 /**
60 * Returns the event name of the call site.
61 *
62 * @return the event name
63 */
64 public String getEventName() {
65 return fEventName;
66 }
67
68 /**
69 * Returns the instruction pointer of the call site.
70 *
71 * @return the instruction pointer
72 */
73 public long getIntructionPointer() {
74 return fInstructionPointer;
75 }
76
77 // ------------------------------------------------------------------------
78 // Accessors
79 // ------------------------------------------------------------------------
80
81 @Override
82 public int hashCode() {
83 final int prime = 31;
84 int result = super.hashCode();
85 result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
86 result = prime * result + (int) (fInstructionPointer ^ (fInstructionPointer >>> 32));
87 return result;
88 }
89
90 @Override
91 public boolean equals(Object obj) {
92 if (this == obj) {
93 return true;
94 }
95 if (!super.equals(obj)) {
96 return false;
97 }
98 if (getClass() != obj.getClass()) {
99 return false;
100 }
101 CtfTmfCallsite other = (CtfTmfCallsite) obj;
102 if (!Objects.equals(fEventName, other.fEventName)) {
103 return false;
104 }
105 if (fInstructionPointer != other.fInstructionPointer) {
106 return false;
107 }
108 return true;
109 }
110
111 @Override
112 public String toString() {
113 return getEventName() + "@0x" + Long.toHexString(fInstructionPointer) + ": " + //$NON-NLS-1$ //$NON-NLS-2$
114 getFileName() + ':' + String.valueOf(getLineNo()) + ' ' + getFileName() + "()"; //$NON-NLS-1$
115 }
116 }
This page took 0.043514 seconds and 6 git commands to generate.