gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / model / TraceEnablement.java
CommitLineData
eb1bab5b 1/**********************************************************************
4e94d876 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
4e94d876 11 * Jonathan Rajotte - Machine interface support and utility function
eb1bab5b 12 **********************************************************************/
8e8c0226 13package org.eclipse.linuxtools.internal.lttng2.control.core.model;
eb1bab5b 14
4e94d876
JRJ
15import java.security.InvalidParameterException;
16
eb1bab5b 17/**
eb1bab5b 18 * Enumeration for enabled/disabled states.
b0318660 19 *
dbd4432d 20 * @author Bernd Hufmann
eb1bab5b
BH
21 */
22public enum TraceEnablement {
23
24 // ------------------------------------------------------------------------
25 // Enum definition
26 // ------------------------------------------------------------------------
b0318660 27 /** Tracing is disabled */
4e94d876 28 DISABLED("disabled", "false"), //$NON-NLS-1$ //$NON-NLS-2$
b0318660 29 /** Tracing is enabled */
4e94d876 30 ENABLED("enabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$
eb1bab5b
BH
31
32 // ------------------------------------------------------------------------
33 // Attributes
34 // ------------------------------------------------------------------------
35 /**
b0318660 36 * Name of enum
eb1bab5b
BH
37 */
38 private final String fInName;
4e94d876 39 private final String fInMiName;
eb1bab5b
BH
40
41 // ------------------------------------------------------------------------
42 // Constuctors
43 // ------------------------------------------------------------------------
b0318660 44
eb1bab5b
BH
45 /**
46 * Private constructor
4e94d876
JRJ
47 *
48 * @param name
49 * the name of state
eb1bab5b 50 */
4e94d876 51 private TraceEnablement(String name, String miName) {
eb1bab5b 52 fInName = name;
4e94d876 53 fInMiName = miName;
eb1bab5b
BH
54 }
55
56 // ------------------------------------------------------------------------
57 // Accessors
58 // ------------------------------------------------------------------------
59 /**
60 * @return state name
61 */
62 public String getInName() {
63 return fInName;
64 }
4e94d876
JRJ
65
66 /**
67 * @return state name
68 */
69 public String getInMiName() {
70 return fInMiName;
71 }
72
73 /**
74 * @param name
75 * name of the desired enum
76 * @return the corresponding {@link TraceEnablement} matching name
77 */
78 public static TraceEnablement valueOfString(String name) {
79 if (name == null) {
80 throw new InvalidParameterException();
81 }
82 for (TraceEnablement enablementType : TraceEnablement.values()) {
83 boolean exist = enablementType.fInName.equalsIgnoreCase(name) || enablementType.fInMiName.equalsIgnoreCase(name);
84 if (exist) {
85 return enablementType;
86 }
87 }
88 return DISABLED;
89 }
90
b0318660 91}
This page took 0.052551 seconds and 5 git commands to generate.