lttng: Add a diagram showing the dependencies between plugins
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core / src / org / eclipse / linuxtools / internal / lttng2 / core / control / model / impl / EventInfo.java
CommitLineData
eb1bab5b 1/**********************************************************************
11252342
AM
2 * Copyright (c) 2012, 2013 Ericsson
3 *
eb1bab5b
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:
eb1bab5b
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
9315aeee 12package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
eb1bab5b 13
9315aeee
BH
14import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
15import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
eb1bab5b
BH
16
17/**
eb1bab5b
BH
18* <p>
19* Implementation of the trace event interface (IEventInfo) to store event
11252342 20* related data.
eb1bab5b 21* </p>
11252342 22*
dbd4432d 23* @author Bernd Hufmann
eb1bab5b
BH
24*/
25public class EventInfo extends BaseEventInfo implements IEventInfo {
26
27 // ------------------------------------------------------------------------
28 // Attributes
29 // ------------------------------------------------------------------------
30 /**
31 * The enable state of the event.
32 */
33 private TraceEnablement fState = TraceEnablement.DISABLED;
11252342 34
eb1bab5b
BH
35 // ------------------------------------------------------------------------
36 // Constructors
37 // ------------------------------------------------------------------------
38 /**
39 * Constructor
40 * @param name - name of event
41 */
42 public EventInfo(String name) {
43 super(name);
44 }
11252342 45
eb1bab5b
BH
46 /**
47 * Copy constructor
48 * @param other - the instance to copy
49 */
50 public EventInfo(EventInfo other) {
51 super(other);
52 fState = other.fState;
53 }
11252342 54
eb1bab5b
BH
55 // ------------------------------------------------------------------------
56 // Accessors
57 // ------------------------------------------------------------------------
11252342 58
eb1bab5b
BH
59 @Override
60 public TraceEnablement getState() {
61 return fState;
62 }
63
eb1bab5b
BH
64 @Override
65 public void setState(TraceEnablement state) {
66 fState = state;
67 }
68
eb1bab5b
BH
69 @Override
70 public void setState(String stateName) {
71 fState = TraceEnablement.DISABLED;
72 if (TraceEnablement.DISABLED.getInName().equals(stateName)) {
73 fState = TraceEnablement.DISABLED;
74 } else if (TraceEnablement.ENABLED.getInName().equals(stateName)) {
75 fState = TraceEnablement.ENABLED;
76 }
77 }
78
eb1bab5b
BH
79 @Override
80 public int hashCode() {
d132bcc7
BH
81 final int prime = 31;
82 int result = super.hashCode();
83 result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
eb1bab5b
BH
84 return result;
85 }
86
eb1bab5b 87 @Override
d132bcc7
BH
88 public boolean equals(Object obj) {
89 if (this == obj) {
90 return true;
91 }
92 if (!super.equals(obj)) {
eb1bab5b
BH
93 return false;
94 }
d132bcc7 95 if (getClass() != obj.getClass()) {
eb1bab5b
BH
96 return false;
97 }
d132bcc7
BH
98 EventInfo other = (EventInfo) obj;
99 if (fState != other.fState) {
eb1bab5b
BH
100 return false;
101 }
102 return true;
103 }
d132bcc7 104
eb1bab5b
BH
105 @SuppressWarnings("nls")
106 @Override
107 public String toString() {
108 StringBuffer output = new StringBuffer();
109 output.append("[EventInfo(");
110 output.append(super.toString());
111 output.append(",State=");
112 output.append(fState);
113 output.append(")]");
114 return output.toString();
115 }
116}
This page took 0.04436 seconds and 5 git commands to generate.