Method: static {...}

1: /*******************************************************************************
2: *
3: *        Copyright (c) 2009 Fujitsu Services Ltd.
4: *
5: *        Author: Nick Battle
6: *
7: *        This file is part of VDMJ.
8: *
9: *        VDMJ is free software: you can redistribute it and/or modify
10: *        it under the terms of the GNU General Public License as published by
11: *        the Free Software Foundation, either version 3 of the License, or
12: *        (at your option) any later version.
13: *
14: *        VDMJ is distributed in the hope that it will be useful,
15: *        but WITHOUT ANY WARRANTY; without even the implied warranty of
16: *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: *        GNU General Public License for more details.
18: *
19: *        You should have received a copy of the GNU General Public License
20: *        along with VDMJ. If not, see <http://www.gnu.org/licenses/>.
21: *
22: ******************************************************************************/
23:
24: package org.overture.interpreter.debug;
25:
26: public enum DBGPCommandType
27: {
28:         STATUS("status"), FEATURE_GET("feature_get"), FEATURE_SET("feature_set"), RUN(
29:                         "run"), EVAL("eval"), EXPR("expr"), EXEC("exec"), STEP_INTO(
30:                         "step_into"), STEP_OVER("step_over"), STEP_OUT("step_out"), STOP(
31:                         "stop"), DETACH("detach"), BREAKPOINT_GET("breakpoint_get"), BREAKPOINT_SET(
32:                         "breakpoint_set"), BREAKPOINT_UPDATE("breakpoint_update"), BREAKPOINT_REMOVE(
33:                         "breakpoint_remove"), BREAKPOINT_LIST("breakpoint_list"), STACK_DEPTH(
34:                         "stack_depth"), STACK_GET("stack_get"), CONTEXT_NAMES(
35:                         "context_names"), CONTEXT_GET("context_get"), PROPERTY_GET(
36:                         "property_get"), PROPERTY_SET("property_set"), SOURCE("source"), STDOUT(
37:                         "stdout"), STDERR("stderr"), UNKNOWN("?"),
38:
39:         // Overture extras
40:         XCMD_OVERTURE_CMD("xcmd_overture_cmd");
41:
42:         public String value;
43:
44:         DBGPCommandType(String value)
45:         {
46:                 this.value = value;
47:         }
48:
49:         public static DBGPCommandType lookup(String string) throws DBGPException
50:         {
51:                 for (DBGPCommandType cmd : values())
52:                 {
53:                         if (cmd.value.equals(string))
54:                         {
55:                                 return cmd;
56:                         }
57:                 }
58:
59:                 throw new DBGPException(DBGPErrorCode.PARSE, string);
60:         }
61:
62:         @Override
63:         public String toString()
64:         {
65:                 return value;
66:         }
67: }