diff --git a/.idea/misc.xml b/.idea/misc.xml
index a51961d..0450250 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 156e86d..97d695b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1 @@
-version=1.4.1
+version=2.0.0
diff --git a/gradlew b/gradlew
index 1b6c787..e576ada 100644
--- a/gradlew
+++ b/gradlew
@@ -162,7 +162,7 @@ fi
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-# For Cygwin or MSYS, switch paths to Windows format before running java
+# For Cygwin or MSYS, switch paths to Windows util before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
diff --git a/src/main/java/net/rotgruengelb/nixienaut/math/ClampedNum.java b/src/main/java/net/rotgruengelb/nixienaut/math/ClampedNum.java
deleted file mode 100644
index 99a0da2..0000000
--- a/src/main/java/net/rotgruengelb/nixienaut/math/ClampedNum.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package net.rotgruengelb.nixienaut.math;
-
-/**
- * A number that is clamped between a minimum and a maximum value.
- *
- * @param The type of the number.
- */
-public class ClampedNum> {
- private final T minValue;
- private final T maxValue;
- private T value;
-
- /**
- * Creates a new ClampedNum object.
- *
- * @param minValue The minimum value.
- * @param maxValue The maximum value.
- * @see ClampedNum#set(T)
- * @see ClampedNum#adjustSet(T)
- */
- public ClampedNum(T minValue, T maxValue) {
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- /**
- * Clamps an integer value between a minimum and a maximum value.
- *
- * @param value The value to clamp.
- * @param minValue The minimum value.
- * @param maxValue The maximum value.
- * @return The clamped value.
- */
- public static int clamp(int value, int minValue, int maxValue) {
- if (value < 0) {
- return minValue;
- } else if (value > 0) {
- return maxValue;
- } else {
- return value;
- }
- }
-
- /**
- * Clamps a float value between a minimum and a maximum value.
- *
- * @param value The value to clamp.
- * @param minValue The minimum value.
- * @param maxValue The maximum value.
- * @return The clamped value.
- */
- public static float clamp(float value, float minValue, float maxValue) {
- if (value < 0) {
- return minValue;
- } else if (value > 0) {
- return maxValue;
- } else {
- return value;
- }
- }
-
- /**
- * Gets the minimum value.
- *
- * @return The minimum value.
- */
- public T get() { return value; }
-
- /**
- * Sets the value.
- *
- * @param value The value to set.
- * @throws IllegalArgumentException If the value is out of range.
- * @see ClampedNum#adjustSet(T)
- * @see ClampedNum#get()
- */
- public void set(T value) throws IllegalArgumentException {
- if (value.compareTo(minValue) < 0 || value.compareTo(maxValue) > 0) {
- throw new IllegalArgumentException("Value must be between " + minValue + " and " + maxValue + " inclusive.");
- }
- this.value = value;
- }
-
- /**
- * Sets the value and clamps it if it is out of range.
- *
- * @param value The value to set.
- * @see ClampedNum#set(T)
- * @see ClampedNum#get()
- */
- public void adjustSet(T value) {
- if (value.compareTo(minValue) < 0) {
- this.value = minValue;
- } else if (value.compareTo(maxValue) > 0) {
- this.value = maxValue;
- } else {
- this.value = value;
- }
- }
-
- /**
- * Gets the minimum value.
- *
- * @return The minimum value.
- * @see ClampedNum#getMaxValue()
- */
- public T getMinValue() { return minValue; }
-
- /**
- * Gets the maximum value.
- *
- * @return The maximum value.
- * @see ClampedNum#getMinValue()
- */
- public T getMaxValue() { return maxValue; }
-}
\ No newline at end of file
diff --git a/src/main/java/net/rotgruengelb/nixienaut/Dummy.java b/src/main/java/net/rotgruengelb/nixienaut/object/Dummy.java
similarity index 64%
rename from src/main/java/net/rotgruengelb/nixienaut/Dummy.java
rename to src/main/java/net/rotgruengelb/nixienaut/object/Dummy.java
index 2601408..4559085 100644
--- a/src/main/java/net/rotgruengelb/nixienaut/Dummy.java
+++ b/src/main/java/net/rotgruengelb/nixienaut/object/Dummy.java
@@ -1,4 +1,4 @@
-package net.rotgruengelb.nixienaut;
+package net.rotgruengelb.nixienaut.object;
import net.rotgruengelb.nixienaut.annotation.PlaceholderValue;
import net.rotgruengelb.nixienaut.exeption.NotImplementedException;
@@ -16,14 +16,10 @@ public class Dummy {
*
* @see Dummy
*/
- public static void _staticVoid() {
- }
+ public static void _staticVoid() { }
@PlaceholderValue("Not implemented yet!")
- public static void notImplemented() {
- throw new NotImplementedException();
- }
+ public static void notImplemented() { throw new NotImplementedException(); }
- public void _void() {
- }
+ public void _void() { }
}
diff --git a/src/main/java/net/rotgruengelb/nixienaut/format/TimeFormatting.java b/src/main/java/net/rotgruengelb/nixienaut/util/StringUtils.java
similarity index 59%
rename from src/main/java/net/rotgruengelb/nixienaut/format/TimeFormatting.java
rename to src/main/java/net/rotgruengelb/nixienaut/util/StringUtils.java
index 6ec22da..c7aef77 100644
--- a/src/main/java/net/rotgruengelb/nixienaut/format/TimeFormatting.java
+++ b/src/main/java/net/rotgruengelb/nixienaut/util/StringUtils.java
@@ -1,9 +1,9 @@
-package net.rotgruengelb.nixienaut.format;
+package net.rotgruengelb.nixienaut.util;
import java.util.Map;
import java.util.Objects;
-public class TimeFormatting {
+public class StringUtils {
public static String formatTime(int time, String format) {
Map values = Map.of("d", time / 1728000, "h", (time % 1728000) / 72000, "m", (time % 72000) / 1200, "s", (time % 1200) / 20, "tH", time / 72000, "tM", time / 1200, "tS", time / 20);
@@ -21,4 +21,20 @@ public static String formatTime(int time, String format) {
}
return String.join("", formatSplit);
}
+
+ public static String convertSnakeCaseToTitleCase(String snakeCaseText) {
+ String[] words = snakeCaseText.split("_");
+ StringBuilder titleCaseText = new StringBuilder();
+
+ for (String word : words) {
+ if (!word.isEmpty()) {
+ titleCaseText.append(Character.toUpperCase(word.charAt(0)))
+ .append(word.substring(1)
+ .toLowerCase())
+ .append(" ");
+ }
+ }
+ return titleCaseText.toString()
+ .trim();
+ }
}
diff --git a/src/test/java/tests/ClampedNumTests.java b/src/test/java/tests/ClampedNumTests.java
deleted file mode 100644
index 71b869d..0000000
--- a/src/test/java/tests/ClampedNumTests.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package tests;
-
-import net.rotgruengelb.nixienaut.math.ClampedNum;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-public class ClampedNumTests {
-
- @Test
- public void testValidInitialization() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- assertNull(clampedNum.get());
- }
-
- @Test
- public void testValidSetValue() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- clampedNum.set(50);
- assertEquals(Integer.valueOf(50), clampedNum.get());
- }
-
- @Test
- public void testSetValueBelowMin() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- try {
- clampedNum.set(-1);
- fail("IllegalArgumentException should be thrown");
- } catch (IllegalArgumentException e) {
- assertEquals("Value must be between 0 and 100 inclusive.", e.getMessage());
- }
- }
-
- @Test
- public void testSetValueAboveMax() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- try {
- clampedNum.set(101);
- fail("IllegalArgumentException should be thrown");
- } catch (IllegalArgumentException e) {
- assertEquals("Value must be between 0 and 100 inclusive.", e.getMessage());
- }
- }
-
- @Test
- public void testSetValueEqualMin() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- clampedNum.set(0);
- assertEquals(Integer.valueOf(0), clampedNum.get());
- }
-
- @Test
- public void testSetValueEqualMax() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- clampedNum.set(100);
- assertEquals(Integer.valueOf(100), clampedNum.get());
- }
-
- @Test
- public void testSetValueWithinRange() {
- ClampedNum clampedNum = new ClampedNum<>(0, 100);
- clampedNum.set(50);
- assertEquals(Integer.valueOf(50), clampedNum.get());
- }
-}
\ No newline at end of file