Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
+52
View File
@@ -0,0 +1,52 @@
package core;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class Util {
/**
* Capitalize the first letter of the string
* @return Capitalized string
*/
public static String capitalize(String name) {
if (name != null && name.length() != 0) {
char[] chars = name.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);
} else {
return name;
}
}
public static String strToEnum(String name) {
name = name.toUpperCase();
return name.replaceAll(" ", "_");
}
public static String enumToString(String name) {
name = name.toLowerCase();
name = name.replaceAll("_", " ");
return capitalize(name);
}
public static double clamp(double input, double min, double max) {
return Math.max(Math.min(input, max), min);
}
public static long nextMidnight(long currentTime) {
Date date = new Date();
Calendar cal = Calendar.getInstance();
date.setTime(currentTime);
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.add(Calendar.HOUR_OF_DAY, 24);
return cal.getTime().getTime();
}
}