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 * Jonathan Rajotte - Machine interface support and utility function
12 **********************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.model
;
15 import java
.security
.InvalidParameterException
;
18 * Enumeration for enabled/disabled states.
20 * @author Bernd Hufmann
22 public enum TraceEnablement
{
24 // ------------------------------------------------------------------------
26 // ------------------------------------------------------------------------
27 /** Tracing is disabled */
28 DISABLED("disabled", "false"), //$NON-NLS-1$ //$NON-NLS-2$
29 /** Tracing is enabled */
30 ENABLED("enabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
38 private final String fInName
;
39 private final String fInMiName
;
41 // ------------------------------------------------------------------------
43 // ------------------------------------------------------------------------
51 private TraceEnablement(String name
, String miName
) {
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
62 public String
getInName() {
69 public String
getInMiName() {
75 * name of the desired enum
76 * @return the corresponding {@link TraceEnablement} matching name
78 public static TraceEnablement
valueOfString(String name
) {
80 throw new InvalidParameterException();
82 for (TraceEnablement enablementType
: TraceEnablement
.values()) {
83 boolean exist
= enablementType
.fInName
.equalsIgnoreCase(name
) || enablementType
.fInMiName
.equalsIgnoreCase(name
);
85 return enablementType
;