357c509f4a252bf929f3bc8bd6d2d6f5fb3e7d58
[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 }
82
83 // ------------------------------------------------------------------------
84 // Accessors
85 // ------------------------------------------------------------------------
86
87 @Override
88 public String getAddress() {
89 return fAddress;
90 }
91
92 @Override
93 public void setAddress(String address) {
94 fAddress = address;
95 }
96
97 @Override
98 public String getOffset() {
99 return fOffset;
100 }
101
102 @Override
103 public void setOffset(String offset) {
104 fOffset = offset;
105 }
106
107 @Override
108 public String getSymbol() {
109 return fSymbol;
110 }
111
112 @Override
113 public void setSymbol(String symbol) {
114 fSymbol = symbol;
115 }
116
117 // ------------------------------------------------------------------------
118 // Operation
119 // ------------------------------------------------------------------------
120
121 @Override
122 public int hashCode() {
123 final int prime = 31;
124 int result = super.hashCode();
125 result = prime * result + ((fAddress == null) ? 0 : fAddress.hashCode());
126 result = prime * result + ((fOffset == null) ? 0 : fOffset.hashCode());
127 result = prime * result + ((fSymbol == null) ? 0 : fSymbol.hashCode());
128 return result;
129 }
130
131 @Override
132 public boolean equals(Object obj) {
133 if (this == obj) {
134 return true;
135 }
136 if (!super.equals(obj)) {
137 return false;
138 }
139 if (getClass() != obj.getClass()) {
140 return false;
141 }
142 ProbeEventInfo other = (ProbeEventInfo) obj;
143 if (fAddress == null) {
144 if (other.fAddress != null) {
145 return false;
146 }
147 } else if (!fAddress.equals(other.fAddress)) {
148 return false;
149 }
150 if (fOffset == null) {
151 if (other.fOffset != null) {
152 return false;
153 }
154 } else if (!fOffset.equals(other.fOffset)) {
155 return false;
156 }
157 if (fSymbol == null) {
158 if (other.fSymbol != null) {
159 return false;
160 }
161 } else if (!fSymbol.equals(other.fSymbol)) {
162 return false;
163 }
164 return true;
165 }
166
167 @SuppressWarnings("nls")
168 @Override
169 public String toString() {
170 StringBuffer output = new StringBuffer();
171 output.append("[ProbeEventInfo(");
172 output.append(super.toString());
173 if (fAddress != null) {
174 output.append(",fAddress=");
175 output.append(fAddress);
176 } else {
177 output.append(",fOffset=");
178 output.append(fOffset);
179 output.append(",fSymbol=");
180 output.append(fSymbol);
181 }
182 output.append(")]");
183 return output.toString();
184 }
185
186 }
This page took 0.052634 seconds and 4 git commands to generate.