enum reverse cache objects

This commit is contained in:
Shikhar Bhushan
2010-08-08 17:45:48 +01:00
parent 7797d774ac
commit ebd5036d64
3 changed files with 3 additions and 6 deletions

View File

@@ -67,8 +67,7 @@ public enum Message {
static { static {
for (Message c : Message.values()) for (Message c : Message.values())
if (cache[c.toByte()] == null) cache[c.toByte()] = c;
cache[c.toByte()] = c;
} }
public static Message fromByte(byte b) { public static Message fromByte(byte b) {

View File

@@ -27,8 +27,7 @@ public enum Signal {
INT("INT"), INT("INT"),
KILL("KILL"), KILL("KILL"),
PIPE("PIPE"), PIPE("PIPE"),
QUIT( QUIT("QUIT"),
"QUIT"),
SEGV("SEGV"), SEGV("SEGV"),
TERM("TERM"), TERM("TERM"),
USR1("USR1"), USR1("USR1"),

View File

@@ -52,8 +52,7 @@ public enum PacketType {
static { static {
for (PacketType t : PacketType.values()) for (PacketType t : PacketType.values())
if (cache[t.toByte() & 0xff] == null) cache[t.toByte() & 0xff] = t;
cache[t.toByte() & 0xff] = t;
} }
private PacketType(int b) { private PacketType(int b) {