Make utility methods in ATNDeserializer static

This commit is contained in:
Sam Harwell 2013-11-21 12:27:51 -06:00
parent 2618aa335a
commit 7f15889d92
2 changed files with 8 additions and 8 deletions

View File

@ -527,20 +527,20 @@ public class ATNDeserializer {
} }
} }
protected int toInt(char c) { protected static int toInt(char c) {
return c; return c;
} }
protected int toInt32(char[] data, int offset) { protected static int toInt32(char[] data, int offset) {
return (int)data[offset] | ((int)data[offset + 1] << 16); return (int)data[offset] | ((int)data[offset + 1] << 16);
} }
protected long toLong(char[] data, int offset) { protected static long toLong(char[] data, int offset) {
long lowOrder = toInt32(data, offset) & 0x00000000FFFFFFFFL; long lowOrder = toInt32(data, offset) & 0x00000000FFFFFFFFL;
return lowOrder | ((long)toInt32(data, offset + 2) << 32); return lowOrder | ((long)toInt32(data, offset + 2) << 32);
} }
protected UUID toUUID(char[] data, int offset) { protected static UUID toUUID(char[] data, int offset) {
long leastSigBits = toLong(data, offset); long leastSigBits = toLong(data, offset);
long mostSigBits = toLong(data, offset + 4); long mostSigBits = toLong(data, offset + 4);
return new UUID(mostSigBits, leastSigBits); return new UUID(mostSigBits, leastSigBits);

View File

@ -145,7 +145,7 @@ public abstract class ATNSimulator {
*/ */
@Deprecated @Deprecated
public static int toInt(char c) { public static int toInt(char c) {
return new ATNDeserializer().toInt(c); return ATNDeserializer.toInt(c);
} }
/** /**
@ -153,7 +153,7 @@ public abstract class ATNSimulator {
*/ */
@Deprecated @Deprecated
public static int toInt32(char[] data, int offset) { public static int toInt32(char[] data, int offset) {
return new ATNDeserializer().toInt32(data, offset); return ATNDeserializer.toInt32(data, offset);
} }
/** /**
@ -161,7 +161,7 @@ public abstract class ATNSimulator {
*/ */
@Deprecated @Deprecated
public static long toLong(char[] data, int offset) { public static long toLong(char[] data, int offset) {
return new ATNDeserializer().toLong(data, offset); return ATNDeserializer.toLong(data, offset);
} }
/** /**
@ -169,7 +169,7 @@ public abstract class ATNSimulator {
*/ */
@Deprecated @Deprecated
public static UUID toUUID(char[] data, int offset) { public static UUID toUUID(char[] data, int offset) {
return new ATNDeserializer().toUUID(data, offset); return ATNDeserializer.toUUID(data, offset);
} }
/** /**