96de7e33b4d3eaff4a857ba9207811df3a24c97c
[platform/upstream/iotivity.git] / service / simulator / java / sdk / src / org / oic / simulator / SimulatorResult.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.oic.simulator;
18
19 /**
20  * This Enum contains Status codes for Success and Errors.
21  */
22 public enum SimulatorResult {
23     /** STACK error codes - START */
24     SIMULATOR_OK, SIMULATOR_RESOURCE_CREATED, SIMULATOR_RESOURCE_DELETED, SIMULATOR_CONTINUE, SIMULATOR_INVALID_URI, SIMULATOR_INVALID_QUERY, SIMULATOR_INVALID_IP, SIMULATOR_INVALID_PORT, SIMULATOR_INVALID_CALLBACK, SIMULATOR_INVALID_METHOD, SIMULATOR_INVALID_PARAM, SIMULATOR_INVALID_OBSERVE_PARAM, SIMULATOR_NO_MEMORY, SIMULATOR_COMM_ERROR, SIMULATOR_TIMEOUT, SIMULATOR_ADAPTER_NOT_ENABLED, SIMULATOR_NOTIMPL, SIMULATOR_NO_RESOURCE, SIMULATOR_RESOURCE_ERROR, SIMULATOR_SLOW_RESOURCE, SIMULATOR_DUPLICATE_REQUEST, SIMULATOR_NO_OBSERVERS, SIMULATOR_OBSERVER_NOT_FOUND, SIMULATOR_VIRTUAL_DO_NOT_HANDLE, SIMULATOR_INVALID_OPTION, SIMULATOR_MALFORMED_RESPONSE, SIMULATOR_PERSISTENT_BUFFER_REQUIRED, SIMULATOR_INVALID_REQUEST_HANDLE, SIMULATOR_INVALID_DEVICE_INFO, SIMULATOR_INVALID_JSON, SIMULATOR_UNAUTHORIZED_REQ,
25
26     SIMULATOR_PRESENCE_STOPPED, SIMULATOR_PRESENCE_TIMEOUT, SIMULATOR_PRESENCE_DO_NOT_HANDLE,
27     /** STACK error codes - END */
28
29     /** Simulator specific error codes - START */
30     SIMULATOR_INVALID_TYPE, SIMULATOR_NOT_SUPPORTED, SIMULATOR_OPERATION_NOT_ALLOWED, SIMULATOR_OPERATION_IN_PROGRESS,
31
32     SIMULATOR_INVALID_RESPONSE_CODE, SIMULATOR_UKNOWN_PROPERTY, SIMULATOR_TYPE_MISMATCH, SIMULATOR_BAD_VALUE, SIMULATOR_BAD_OBJECT, SIMULATOR_BAD_SCHEMA,
33     /** Simulator specific error codes - END */
34
35     SIMULATOR_ERROR;
36
37     /**
38      * This method returns the {@link SimulatorResult} at the given
39      * position(ordinal).
40      *
41      * @param ordinal
42      *            Index of the constant.
43      * @return {@link SimulatorResult} constant at the given index.
44      */
45     public static SimulatorResult get(int ordinal) {
46
47         SimulatorResult result;
48
49         if (ordinal == 0)
50             result = SimulatorResult.values()[0];
51         else if (ordinal == 1)
52             result = SimulatorResult.values()[1];
53         else if (ordinal == 2)
54             result = SimulatorResult.values()[2];
55         else if (ordinal == 3)
56             result = SimulatorResult.values()[3];
57
58         else if (ordinal == 20)
59             result = SimulatorResult.values()[4];
60         else if (ordinal == 21)
61             result = SimulatorResult.values()[5];
62         else if (ordinal == 22)
63             result = SimulatorResult.values()[6];
64         else if (ordinal == 23)
65             result = SimulatorResult.values()[7];
66         else if (ordinal == 24)
67             result = SimulatorResult.values()[8];
68         else if (ordinal == 25)
69             result = SimulatorResult.values()[9];
70         else if (ordinal == 26)
71             result = SimulatorResult.values()[10];
72         else if (ordinal == 27)
73             result = SimulatorResult.values()[11];
74         else if (ordinal == 28)
75             result = SimulatorResult.values()[12];
76         else if (ordinal == 29)
77             result = SimulatorResult.values()[13];
78         else if (ordinal == 30)
79             result = SimulatorResult.values()[14];
80         else if (ordinal == 31)
81             result = SimulatorResult.values()[15];
82         else if (ordinal == 32)
83             result = SimulatorResult.values()[16];
84         else if (ordinal == 33)
85             result = SimulatorResult.values()[17];
86         else if (ordinal == 34)
87             result = SimulatorResult.values()[18];
88         else if (ordinal == 35)
89             result = SimulatorResult.values()[19];
90         else if (ordinal == 36)
91             result = SimulatorResult.values()[20];
92         else if (ordinal == 37)
93             result = SimulatorResult.values()[21];
94         else if (ordinal == 38)
95             result = SimulatorResult.values()[22];
96         else if (ordinal == 39)
97             result = SimulatorResult.values()[23];
98         else if (ordinal == 40)
99             result = SimulatorResult.values()[24];
100         else if (ordinal == 41)
101             result = SimulatorResult.values()[25];
102         else if (ordinal == 42)
103             result = SimulatorResult.values()[26];
104         else if (ordinal == 43)
105             result = SimulatorResult.values()[27];
106         else if (ordinal == 44)
107             result = SimulatorResult.values()[28];
108         else if (ordinal == 45)
109             result = SimulatorResult.values()[29];
110         else if (ordinal == 46)
111             result = SimulatorResult.values()[30];
112
113         else if (ordinal == 128)
114             result = SimulatorResult.values()[31];
115         else if (ordinal == 129)
116             result = SimulatorResult.values()[32];
117         else if (ordinal == 130)
118             result = SimulatorResult.values()[33];
119
120         else if (ordinal == 131 || ordinal == 47)
121             result = SimulatorResult.values()[34];
122         else if (ordinal == 132 || ordinal == 48)
123             result = SimulatorResult.values()[35];
124         else if (ordinal == 133 || ordinal == 49)
125             result = SimulatorResult.values()[36];
126         else if (ordinal == 134 || ordinal == 50)
127             result = SimulatorResult.values()[37];
128
129         else if (ordinal == 135 || ordinal == 51)
130             result = SimulatorResult.values()[38];
131         else if (ordinal == 136 || ordinal == 52)
132             result = SimulatorResult.values()[39];
133         else if (ordinal == 137 || ordinal == 53)
134             result = SimulatorResult.values()[40];
135         else if (ordinal == 138 || ordinal == 54)
136             result = SimulatorResult.values()[41];
137
138         else
139             result = SimulatorResult.values()[42];
140         return result;
141     }
142 }