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
eb1bab5b 1/**********************************************************************
0df4af5f 2 * Copyright (c) 2012, 2014 Ericsson
b0318660 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
b0318660
AM
8 *
9 * Contributors:
eb1bab5b 10 * Bernd Hufmann - Initial API and implementation
0df4af5f 11 * Jonathan Rajotte - machine interface support and utility function
eb1bab5b 12 *********************************************************************/
0df4af5f 13
8e8c0226 14package org.eclipse.linuxtools.internal.lttng2.control.core.model;
eb1bab5b
BH
15
16/**
eb1bab5b 17 * Session state enumeration.
b0318660 18 *
dbd4432d 19 * @author Bernd Hufmann
eb1bab5b
BH
20 */
21public enum TraceSessionState {
b0318660 22
eb1bab5b
BH
23 // ------------------------------------------------------------------------
24 // Enum definition
25 // ------------------------------------------------------------------------
b0318660 26 /** Trace session inactive */
0df4af5f 27 INACTIVE("inactive", "false"), //$NON-NLS-1$ //$NON-NLS-2$
b0318660 28 /** Trace session active */
0df4af5f 29 ACTIVE("active", "true"); //$NON-NLS-1$ //$NON-NLS-2$
eb1bab5b
BH
30
31 // ------------------------------------------------------------------------
32 // Attributes
33 // ------------------------------------------------------------------------
34 /**
b0318660 35 * Name of enum.
eb1bab5b
BH
36 */
37 private final String fInName;
0df4af5f 38 private final String fMiName;
eb1bab5b
BH
39
40 // ------------------------------------------------------------------------
41 // Constuctors
42 // ------------------------------------------------------------------------
b0318660 43
eb1bab5b
BH
44 /**
45 * Private constructor
0df4af5f
JRJ
46 *
47 * @param name
48 * the name of state
eb1bab5b 49 */
0df4af5f 50 private TraceSessionState(String name, String miName) {
eb1bab5b 51 fInName = name;
0df4af5f 52 fMiName = miName;
eb1bab5b
BH
53 }
54
55 // ------------------------------------------------------------------------
56 // Accessors
57 // ------------------------------------------------------------------------
58 /**
59 * @return state name
60 */
61 public String getInName() {
62 return fInName;
63 }
0df4af5f
JRJ
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 }
b0318660 96}
This page took 0.07243 seconds and 5 git commands to generate.