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