Add JUnit tests for LTTng 2.0 tracer control (add-context/calibrate)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / ProbeEventInfo.java
CommitLineData
d132bcc7
BH
1/**********************************************************************
2 * Copyright (c) 2012 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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
115b4a01 12package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
d132bcc7 13
115b4a01 14import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo;
d132bcc7
BH
15
16/**
17* <b><u>ProbleEventInfo</u></b>
18* <p>
19* Implementation of the trace event interface (IProbeEventInfo) to store probe event
20* related data.
21* </p>
22*/
23public class ProbeEventInfo extends EventInfo implements IProbeEventInfo {
24
25 // ------------------------------------------------------------------------
26 // Attributes
27 // ------------------------------------------------------------------------
28 /**
29 * The dynamic probe address (null if symbol is used).
30 */
31 private String fAddress;
32 /**
33 * The dynamic probe offset (if symbol is used).
34 */
35 private String fOffset;
36
37 /**
38 * The symbol name (null if address is used)
39 */
40 private String fSymbol;
41
42
43 // ------------------------------------------------------------------------
44 // Constructors
45 // ------------------------------------------------------------------------
46 /**
47 * Constructor
48 * @param name - name of event
49 */
50 public ProbeEventInfo(String name) {
51 super(name);
52 }
53
54 /**
55 * Copy constructor
56 * @param other - the instance to copy
57 */
58 public ProbeEventInfo(ProbeEventInfo other) {
59 super(other);
60 fAddress = other.fAddress;
61 fOffset = other.fOffset;
62 fSymbol = other.fSymbol;
63 }
64
65 // ------------------------------------------------------------------------
66 // Accessors
67 // ------------------------------------------------------------------------
68
69 /*
70 * (non-Javadoc)
115b4a01 71 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#getAddress()
d132bcc7
BH
72 */
73 @Override
74 public String getAddress() {
75 return fAddress;
76 }
77
78 /*
79 * (non-Javadoc)
115b4a01 80 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#setAddress(java.lang.String)
d132bcc7
BH
81 */
82 @Override
83 public void setAddress(String address) {
84 fAddress = address;
85 }
86
87 /*
88 * (non-Javadoc)
115b4a01 89 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#getOffset()
d132bcc7
BH
90 */
91 @Override
92 public String getOffset() {
93 return fOffset;
94 }
95
96 /*
97 * (non-Javadoc)
115b4a01 98 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#setOffset(java.lang.String)
d132bcc7
BH
99 */
100 @Override
101 public void setOffset(String offset) {
102 fOffset = offset;
103 }
104
105 /*
106 * (non-Javadoc)
115b4a01 107 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#getSymbol()
d132bcc7
BH
108 */
109 @Override
110 public String getSymbol() {
111 return fSymbol;
112 }
113
114 /*
115 * (non-Javadoc)
115b4a01 116 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IProbeEventInfo#setSymbol(java.lang.String)
d132bcc7
BH
117 */
118 @Override
119 public void setSymbol(String symbol) {
120 fSymbol = symbol;
121 }
122
123 // ------------------------------------------------------------------------
124 // Operation
125 // ------------------------------------------------------------------------
4ea599a5 126
d132bcc7
BH
127 /*
128 * (non-Javadoc)
115b4a01 129 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#hashCode()
d132bcc7
BH
130 */
131 @Override
132 public int hashCode() {
133 final int prime = 31;
134 int result = super.hashCode();
135 result = prime * result + ((fAddress == null) ? 0 : fAddress.hashCode());
136 result = prime * result + ((fOffset == null) ? 0 : fOffset.hashCode());
137 result = prime * result + ((fSymbol == null) ? 0 : fSymbol.hashCode());
138 return result;
139 }
140
141 /*
142 * (non-Javadoc)
115b4a01 143 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#equals(java.lang.Object)
d132bcc7
BH
144 */
145 @Override
146 public boolean equals(Object obj) {
147 if (this == obj) {
148 return true;
149 }
150 if (!super.equals(obj)) {
151 return false;
152 }
153 if (getClass() != obj.getClass()) {
154 return false;
155 }
156 ProbeEventInfo other = (ProbeEventInfo) obj;
157 if (fAddress == null) {
158 if (other.fAddress != null) {
159 return false;
160 }
161 } else if (!fAddress.equals(other.fAddress)) {
162 return false;
163 }
164 if (fOffset == null) {
165 if (other.fOffset != null) {
166 return false;
167 }
168 } else if (!fOffset.equals(other.fOffset)) {
169 return false;
170 }
171 if (fSymbol == null) {
172 if (other.fSymbol != null) {
173 return false;
174 }
175 } else if (!fSymbol.equals(other.fSymbol)) {
176 return false;
177 }
178 return true;
179 }
180
181
182 /*
183 * (non-Javadoc)
115b4a01 184 * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.EventInfo#toString()
d132bcc7
BH
185 */
186 @SuppressWarnings("nls")
187 @Override
188 public String toString() {
189 StringBuffer output = new StringBuffer();
190 output.append("[ProbeEventInfo(");
191 output.append(super.toString());
192 if (fAddress != null) {
193 output.append(",fAddress=");
194 output.append(fAddress);
195 } else {
196 output.append(",fOffset=");
197 output.append(fOffset);
198 output.append(",fSymbol=");
199 output.append(fSymbol);
200 }
201 output.append(")]");
202 return output.toString();
203 }
204
d132bcc7 205}
This page took 0.05129 seconds and 5 git commands to generate.