tmf: lttngControl: mi: basic listing support
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / model / TraceSessionState.java
... / ...
CommitLineData
1/**********************************************************************
2 * Copyright (c) 2012, 2014 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 * Jonathan Rajotte - machine interface support and utility function
12 *********************************************************************/
13
14package org.eclipse.linuxtools.internal.lttng2.control.core.model;
15
16/**
17 * Session state enumeration.
18 *
19 * @author Bernd Hufmann
20 */
21public enum TraceSessionState {
22
23 // ------------------------------------------------------------------------
24 // Enum definition
25 // ------------------------------------------------------------------------
26 /** Trace session inactive */
27 INACTIVE("inactive", "false"), //$NON-NLS-1$ //$NON-NLS-2$
28 /** Trace session active */
29 ACTIVE("active", "true"); //$NON-NLS-1$ //$NON-NLS-2$
30
31 // ------------------------------------------------------------------------
32 // Attributes
33 // ------------------------------------------------------------------------
34 /**
35 * Name of enum.
36 */
37 private final String fInName;
38 private final String fMiName;
39
40 // ------------------------------------------------------------------------
41 // Constuctors
42 // ------------------------------------------------------------------------
43
44 /**
45 * Private constructor
46 *
47 * @param name
48 * the name of state
49 */
50 private TraceSessionState(String name, String miName) {
51 fInName = name;
52 fMiName = miName;
53 }
54
55 // ------------------------------------------------------------------------
56 // Accessors
57 // ------------------------------------------------------------------------
58 /**
59 * @return state name
60 */
61 public String getInName() {
62 return fInName;
63 }
64
65 /**
66 * @return the machine interface name
67 */
68 public String getfMiName() {
69 return fMiName;
70 }
71
72 // ------------------------------------------------------------------------
73 // Accessors
74 // ------------------------------------------------------------------------
75 /**
76 * Return the corresponding {@link TraceSessionState} to String "name"
77 *
78 * @param name
79 * String to compare to retrieve the good
80 * {@link TraceSessionState}
81 * @return the corresponding {@link TraceSessionState}
82 */
83 public static TraceSessionState valueOfString(String name) {
84 if (name == null) {
85 return INACTIVE;
86 }
87 for (TraceSessionState tst : TraceSessionState.values()) {
88 boolean isEqual = tst.fInName.equalsIgnoreCase(name) || tst.fMiName.equalsIgnoreCase(name);
89 if (isEqual) {
90 return tst;
91 }
92 }
93 // No match
94 return INACTIVE;
95 }
96}
This page took 0.037613 seconds and 5 git commands to generate.