1
/**********************************************************************
2
* Copyright (c) 2012 Ericsson
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
10
* Bernd Hufmann - Initial API and implementation
11
**********************************************************************/
12
package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
14
import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
15
import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
19
* Implementation of the trace event interface (IEventInfo) to store event
23
* @author Bernd Hufmann
25
public class EventInfo extends BaseEventInfo implements IEventInfo {
27
// ------------------------------------------------------------------------
29
// ------------------------------------------------------------------------
31
* The enable state of the event.
33
private TraceEnablement fState = TraceEnablement.DISABLED;
35
// ------------------------------------------------------------------------
37
// ------------------------------------------------------------------------
40
* @param name - name of event
42
public EventInfo(String name) {
48
* @param other - the instance to copy
50
public EventInfo(EventInfo other) {
52
fState = other.fState;
55
// ------------------------------------------------------------------------
57
// ------------------------------------------------------------------------
60
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IEventInfo#getState()
63
public TraceEnablement getState() {
69
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IEventInfo#setState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEnablement)
72
public void setState(TraceEnablement state) {
78
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IEventInfo#setState(java.lang.String)
81
public void setState(String stateName) {
82
fState = TraceEnablement.DISABLED;
83
if (TraceEnablement.DISABLED.getInName().equals(stateName)) {
84
fState = TraceEnablement.DISABLED;
85
} else if (TraceEnablement.ENABLED.getInName().equals(stateName)) {
86
fState = TraceEnablement.ENABLED;
92
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#hashCode()
95
public int hashCode() {
97
int result = super.hashCode();
98
result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
104
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#equals(java.lang.Object)
107
public boolean equals(Object obj) {
111
if (!super.equals(obj)) {
114
if (getClass() != obj.getClass()) {
117
EventInfo other = (EventInfo) obj;
118
if (fState != other.fState) {
126
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#toString()
128
@SuppressWarnings("nls")
130
public String toString() {
131
StringBuffer output = new StringBuffer();
132
output.append("[EventInfo(");
133
output.append(super.toString());
134
output.append(",State=");
135
output.append(fState);
137
return output.toString();