From 34ecdfb19003ccb6d6134bbb1acd9ae361a87f4c Mon Sep 17 00:00:00 2001 From: Shawn Buckley Date: Mon, 19 Oct 2015 19:48:03 -0400 Subject: [PATCH] Replace homegrown character comparision for builtin ones --- src/main/java/gregtech/api/enums/GT_Values.java | 7 ------- src/main/java/gregtech/common/GT_Proxy.java | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index e04b2be9..8fe1f87c 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -32,13 +32,6 @@ public class GT_Values { /** Empty String for an easier Call Hierarchy */ public static final String E = ""; - /** Character Set with all Numbers */ - public static final HashSet CN = new HashSet(Arrays.asList('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')); - /** Character Set with all lowercased Characters */ - public static final HashSet CL = new HashSet(Arrays.asList('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')); - /** Character Set with all uppercased Characters */ - public static final HashSet CU = new HashSet(Arrays.asList('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z')); - /** The first 32 Bits */ public static final int[] B = new int[] {1<<0,1<<1,1<<2,1<<3,1<<4,1<<5,1<<6,1<<7,1<<8,1<<9,1<<10,1<<11,1<<12,1<<13,1<<14,1<<15,1<<16,1<<17,1<<18,1<<19,1<<20,1<<21,1<<22,1<<23,1<<24,1<<25,1<<26,1<<27,1<<28,1<<29,1<<30,1<<31}; diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 26f2b673..07ec6657 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -1125,7 +1125,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_Log.ore.println(tModToName + " is invalid due to being solely uppercased."); return; } - if (GT_Values.CU.contains(Character.valueOf(aEvent.Name.charAt(0)))) { + if (Character.isUpperCase(aEvent.Name.charAt(0))) { GT_Log.ore.println(tModToName + " is invalid due to the first character being uppercased."); } } else { @@ -1142,8 +1142,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } String tName = aEvent.Name.replaceFirst(aPrefix.toString(), ""); if (tName.length() > 0) { - if ((GT_Values.CU.contains(Character.valueOf(tName.charAt(0)))) || (GT_Values.CN.contains(Character.valueOf(tName.charAt(0)))) - || (tName.charAt(0) == '_')) { + char firstChar = tName.charAt(0); + if (Character.isUpperCase(firstChar) || Character.isLowerCase(firstChar) || firstChar == '_') { if (aPrefix.mIsMaterialBased) { aMaterial = Materials.get(tName); if (aMaterial != aMaterial.mMaterialInto) {