SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / util / ByteEnumer.java
1 package com.smartdevicelink.util;\r
2 \r
3 import java.util.Enumeration;\r
4 import java.util.Vector;\r
5 \r
6 public abstract class ByteEnumer {      \r
7         \r
8         protected ByteEnumer(byte value, String name) {\r
9                 this.value = value;\r
10                 this.name = name;\r
11         }\r
12         \r
13         private byte value;\r
14         private String name;\r
15         \r
16         public byte getValue() { return value; }\r
17         public String getName() { return name; }\r
18         \r
19         public boolean equals(ByteEnumer other) {\r
20                 return name == other.getName();\r
21         }\r
22         \r
23         public boolean eq(ByteEnumer other) {\r
24                 return equals(other);\r
25         }\r
26                 \r
27         public byte value() {\r
28                 return value;\r
29         }\r
30         \r
31         public static ByteEnumer get(Vector theList, byte value) {\r
32                 Enumeration enumer = theList.elements();\r
33                 while (enumer.hasMoreElements()) {\r
34                         ByteEnumer current = (ByteEnumer)enumer.nextElement();\r
35                         if (current.getValue() == value) {\r
36                                 return current;\r
37                         }\r
38                 }\r
39                 return null;\r
40         }\r
41         \r
42         public static ByteEnumer get(Vector theList, String name) {\r
43                 Enumeration enumer = theList.elements();\r
44                 while (enumer.hasMoreElements()) {\r
45                         ByteEnumer current = (ByteEnumer)enumer.nextElement();\r
46                         if (current.getName().equals(name)) {\r
47                                 return current;\r
48                         }\r
49                 }\r
50                 return null;\r
51         }\r
52 }\r