BowlerKernel
java-bowler
src
main
java
com
neuronrobotics
sdk
common
BowlerMethod.java
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright 2010 Neuron Robotics, LLC
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
******************************************************************************/
15
package
com.neuronrobotics.sdk.common;
16
17
import
java.util.EnumSet;
18
import
java.util.HashMap;
19
import
java.util.Map;
20
21
// TODO: Auto-generated Javadoc
25
public
enum
BowlerMethod
implements
ISendable
{
26
28
STATUS
(0x00),
29
31
GET
(0x10),
32
34
POST
(0x20),
35
37
CRITICAL
(0x30),
38
40
ASYNCHRONOUS
(0x40);
41
42
44
private
static
final
Map<Byte,BowlerMethod> lookup =
new
HashMap<Byte,BowlerMethod>();
45
46
static
{
47
for
(
BowlerMethod
cm : EnumSet.allOf(
BowlerMethod
.class)) {
48
lookup.put(cm.getValue(), cm);
49
}
50
}
51
53
private
byte
value
;
54
60
private
BowlerMethod
(
int
val) {
61
value = (byte) val;
62
}
63
69
public
byte
getValue
() {
70
return
value;
71
}
72
79
public
static
BowlerMethod
get
(
byte
code) {
80
return
lookup.
get
(code);
81
}
82
83
/* (non-Javadoc)
84
* @see com.neuronrobotics.sdk.common.ISendable#getBytes()
85
*/
86
public
byte
[]
getBytes
() {
87
byte
[] b = {getValue()};
88
return
b;
89
}
90
91
/* (non-Javadoc)
92
* @see java.lang.Enum#toString()
93
*/
94
public
String
toString
(){
95
String s=
"NOT VALID"
;
96
switch
(value){
97
case
0x00:
98
return
"STATUS"
;
99
case
0x10:
100
return
"GET"
;
101
case
0x20:
102
return
"POST"
;
103
case
0x30:
104
return
"CRITICAL"
;
105
case
0x40:
106
return
"ASYNCHRONOUS"
;
107
}
108
return
s;
109
}
110
}
com.neuronrobotics.sdk.common.BowlerMethod
Definition:
BowlerMethod.java:25
com.neuronrobotics.sdk.common.BowlerMethod.toString
String toString()
Definition:
BowlerMethod.java:94
com.neuronrobotics.sdk.common.BowlerMethod.getBytes
byte[] getBytes()
Definition:
BowlerMethod.java:86
com.neuronrobotics.sdk.common.BowlerMethod.getValue
byte getValue()
Definition:
BowlerMethod.java:69
com.neuronrobotics.sdk.common.BowlerMethod.GET
GET
Definition:
BowlerMethod.java:31
com.neuronrobotics.sdk.common.BowlerMethod.ASYNCHRONOUS
ASYNCHRONOUS
Definition:
BowlerMethod.java:40
com.neuronrobotics.sdk.common.BowlerMethod.STATUS
STATUS
Definition:
BowlerMethod.java:28
com.neuronrobotics.sdk.common.BowlerMethod.BowlerMethod
BowlerMethod(int val)
Definition:
BowlerMethod.java:60
com.neuronrobotics.sdk.common.BowlerMethod.value
byte value
Definition:
BowlerMethod.java:53
com.neuronrobotics.sdk.common.BowlerMethod.CRITICAL
CRITICAL
Definition:
BowlerMethod.java:37
com.neuronrobotics.sdk.common.BowlerMethod.POST
POST
Definition:
BowlerMethod.java:34
com.neuronrobotics.sdk.common.BowlerMethod.get
static BowlerMethod get(byte code)
Definition:
BowlerMethod.java:79
com.neuronrobotics.sdk.common.ISendable
Definition:
ISendable.java:22
Generated by
1.9.1