lttng: Rename lttng2 feature/plugins to lttng2.control
[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, 2013 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 package org.eclipse.linuxtools.internal.lttng2.control.core.model.impl;
13
14 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IProbeEventInfo;
15
16 /**
17 * <p>
18 * Implementation of the trace event interface (IProbeEventInfo) to store probe event
19 * related data.
20 * </p>
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 // ------------------------------------------------------------------------
45 // Constructors
46 // ------------------------------------------------------------------------
47 /**
48 * Constructor
49 * @param name - name of event
50 */
51 public ProbeEventInfo(String name) {
52 super(name);
53 }
54
55 /**
56 * Copy constructor
57 * @param other - the instance to copy
58 */
59 public ProbeEventInfo(ProbeEventInfo other) {
60 super(other);
61 fAddress = other.fAddress;
62 fOffset = other.fOffset;
63 fSymbol = other.fSymbol;
64 }
65
66 // ------------------------------------------------------------------------
67 // Accessors
68 // ------------------------------------------------------------------------
69
70 @Override
71 public String getAddress() {
72 return fAddress;
73 }
74
75 @Override
76 public void setAddress(String address) {
77 fAddress = address;
78 }
79
80 @Override
81 public String getOffset() {
82 return fOffset;
83 }
84
85 @Override
86 public void setOffset(String offset) {
87 fOffset = offset;
88 }
89
90 @Override
91 public String getSymbol() {
92 return fSymbol;
93 }
94
95 @Override
96 public void setSymbol(String symbol) {
97 fSymbol = symbol;
98 }
99
100 // ------------------------------------------------------------------------
101 // Operation
102 // ------------------------------------------------------------------------
103
104 @Override
105 public int hashCode() {
106 final int prime = 31;
107 int result = super.hashCode();
108 result = prime * result + ((fAddress == null) ? 0 : fAddress.hashCode());
109 result = prime * result + ((fOffset == null) ? 0 : fOffset.hashCode());
110 result = prime * result + ((fSymbol == null) ? 0 : fSymbol.hashCode());
111 return result;
112 }
113
114 @Override
115 public boolean equals(Object obj) {
116 if (this == obj) {
117 return true;
118 }
119 if (!super.equals(obj)) {
120 return false;
121 }
122 if (getClass() != obj.getClass()) {
123 return false;
124 }
125 ProbeEventInfo other = (ProbeEventInfo) obj;
126 if (fAddress == null) {
127 if (other.fAddress != null) {
128 return false;
129 }
130 } else if (!fAddress.equals(other.fAddress)) {
131 return false;
132 }
133 if (fOffset == null) {
134 if (other.fOffset != null) {
135 return false;
136 }
137 } else if (!fOffset.equals(other.fOffset)) {
138 return false;
139 }
140 if (fSymbol == null) {
141 if (other.fSymbol != null) {
142 return false;
143 }
144 } else if (!fSymbol.equals(other.fSymbol)) {
145 return false;
146 }
147 return true;
148 }
149
150 @SuppressWarnings("nls")
151 @Override
152 public String toString() {
153 StringBuffer output = new StringBuffer();
154 output.append("[ProbeEventInfo(");
155 output.append(super.toString());
156 if (fAddress != null) {
157 output.append(",fAddress=");
158 output.append(fAddress);
159 } else {
160 output.append(",fOffset=");
161 output.append(fOffset);
162 output.append(",fSymbol=");
163 output.append(fSymbol);
164 }
165 output.append(")]");
166 return output.toString();
167 }
168
169 }
This page took 0.035043 seconds and 5 git commands to generate.