1 /**********************************************************************
2 * Copyright (c) 2012, 2014 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
.control
.core
.model
.impl
;
14 import org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.model
.IEventInfo
;
15 import org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.model
.LogLevelType
;
16 import org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.model
.TraceEnablement
;
20 * Implementation of the trace event interface (IEventInfo) to store event
24 * @author Bernd Hufmann
26 public class EventInfo
extends BaseEventInfo
implements IEventInfo
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
32 * The enable state of the event.
34 private TraceEnablement fState
= TraceEnablement
.DISABLED
;
38 private LogLevelType fLogLevelType
= LogLevelType
.LOGLEVEL_NONE
;
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
45 * @param name - name of event
47 public EventInfo(String name
) {
53 * @param other - the instance to copy
55 public EventInfo(EventInfo other
) {
57 fState
= other
.fState
;
58 fLogLevelType
= other
.fLogLevelType
;
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
66 public TraceEnablement
getState() {
71 public void setState(TraceEnablement state
) {
76 public void setState(String stateName
) {
77 fState
= TraceEnablement
.valueOfString(stateName
);
81 public LogLevelType
getLogLevelType() {
86 public void setLogLevelType(LogLevelType type
) {
91 public void setLogLevelType(String shortName
) {
92 fLogLevelType
= LogLevelType
.valueOfString(shortName
);
97 public int hashCode() {
99 int result
= super.hashCode();
100 result
= prime
* result
+ ((fState
== null) ?
0 : (fState
.ordinal() + 1));
101 result
= prime
* result
+ ((fLogLevelType
== null) ?
0 : fLogLevelType
.hashCode());
106 public boolean equals(Object obj
) {
110 if (!super.equals(obj
)) {
113 if (getClass() != obj
.getClass()) {
116 EventInfo other
= (EventInfo
) obj
;
117 if (fState
!= other
.fState
) {
120 if (fLogLevelType
!= other
.fLogLevelType
) {
126 @SuppressWarnings("nls")
128 public String
toString() {
129 StringBuffer output
= new StringBuffer();
130 output
.append("[EventInfo(");
131 output
.append(super.toString());
132 output
.append(",State=");
133 output
.append(fState
);
134 output
.append(",levelType=");
135 output
.append(fLogLevelType
);
137 return output
.toString();