pcap: Rename packages to org.eclipse.tracecompass.*
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / model / impl / ProbeEventInfo.java
CommitLineData
d132bcc7 1/**********************************************************************
8395925e 2 * Copyright (c) 2012, 2014 Ericsson
11252342 3 *
d132bcc7
BH
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
11252342
AM
8 *
9 * Contributors:
d132bcc7
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
8395925e 12
8e8c0226 13package org.eclipse.linuxtools.internal.lttng2.control.core.model.impl;
d132bcc7 14
8395925e 15import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo;
8e8c0226 16import org.eclipse.linuxtools.internal.lttng2.control.core.model.IProbeEventInfo;
d132bcc7
BH
17
18/**
8395925e
JRJ
19 * Implementation of the trace event interface (IProbeEventInfo) to store probe
20 * event related data.
21 *
22 * @author Bernd Hufmann
23 */
d132bcc7
BH
24public 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;
11252342 37
d132bcc7
BH
38 /**
39 * The symbol name (null if address is used)
40 */
41 private String fSymbol;
11252342 42
d132bcc7
BH
43 // ------------------------------------------------------------------------
44 // Constructors
45 // ------------------------------------------------------------------------
46 /**
47 * Constructor
8395925e
JRJ
48 *
49 * @param name
50 * - name of event
d132bcc7
BH
51 */
52 public ProbeEventInfo(String name) {
53 super(name);
54 }
11252342 55
d132bcc7
BH
56 /**
57 * Copy constructor
8395925e
JRJ
58 *
59 * @param other
60 * - the instance to copy
d132bcc7
BH
61 */
62 public ProbeEventInfo(ProbeEventInfo other) {
63 super(other);
64 fAddress = other.fAddress;
65 fOffset = other.fOffset;
66 fSymbol = other.fSymbol;
67 }
11252342 68
8395925e
JRJ
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());
6651c1b4 81 setEventType(eventInfo.getEventType());
8395925e
JRJ
82 }
83
d132bcc7
BH
84 // ------------------------------------------------------------------------
85 // Accessors
86 // ------------------------------------------------------------------------
87
d132bcc7
BH
88 @Override
89 public String getAddress() {
90 return fAddress;
91 }
92
d132bcc7
BH
93 @Override
94 public void setAddress(String address) {
95 fAddress = address;
96 }
97
d132bcc7
BH
98 @Override
99 public String getOffset() {
100 return fOffset;
101 }
102
d132bcc7
BH
103 @Override
104 public void setOffset(String offset) {
105 fOffset = offset;
106 }
107
d132bcc7
BH
108 @Override
109 public String getSymbol() {
110 return fSymbol;
111 }
112
d132bcc7
BH
113 @Override
114 public void setSymbol(String symbol) {
115 fSymbol = symbol;
116 }
117
118 // ------------------------------------------------------------------------
119 // Operation
120 // ------------------------------------------------------------------------
4ea599a5 121
d132bcc7
BH
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
d132bcc7
BH
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
d132bcc7
BH
168 @SuppressWarnings("nls")
169 @Override
170 public String toString() {
171 StringBuffer output = new StringBuffer();
8395925e
JRJ
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();
d132bcc7
BH
185 }
186
d132bcc7 187}
This page took 0.056126 seconds and 5 git commands to generate.