Browse Source

Removed unused code.

pull/13/head
MagicBot 3 years ago
parent
commit
4f2954041d
  1. 55
      src/engine/util/MiscUtils.java

55
src/engine/util/MiscUtils.java

@ -17,13 +17,6 @@ import java.util.regex.Pattern; @@ -17,13 +17,6 @@ import java.util.regex.Pattern;
public class MiscUtils {
// no need to recompile these each call, put them in object scope and
// compile just once.
private static final Pattern lastNameRegex = Pattern
.compile("^[A-Za-z][-'A-Za-z\\x20]*$");
private static final Pattern firstNameRegex = Pattern
.compile("^[A-Za-z]+$");
public static boolean checkIfFirstNameInvalid(String firstName) {
if ((firstName == null) || (firstName.length() == 0)
|| (firstName.length() > MBServerStatics.MAX_NAME_LENGTH)
@ -44,52 +37,4 @@ public class MiscUtils { @@ -44,52 +37,4 @@ public class MiscUtils {
// empty last names are fine, return false
return false;
}
public static String getCallingMethodName() {
StackTraceElement e[] = Thread.currentThread().getStackTrace();
int numElements = e.length;
if (numElements < 1) {
return "NoStack";
}
if (numElements == 1) {
return e[0].getMethodName();
} else if (numElements == 2) {
return e[1].getMethodName();
} else if (numElements == 3) {
return e[2].getMethodName();
} else {
return e[3].getMethodName();
}
}
public static String getCallStackAsString() {
String out = "";
StackTraceElement e[] = Thread.currentThread().getStackTrace();
int numElements = e.length;
for (int i = (numElements - 1); i > 1; --i) {
String[] classStack = e[i].getClassName().split("\\.");
String methName = e[i].getMethodName();
String className = classStack[classStack.length - 1];
if (methName.equals("<init>")) {
methName = className;
}
out += className + '.' + methName + "()";
if (i > 2) {
out += " -> ";
}
}
return out;
}
}

Loading…
Cancel
Save