From 03f21b2d74f8f601ef95c0829d83f7906f3b090f Mon Sep 17 00:00:00 2001 From: Tefek <493msi@gmail.com> Date: Fri, 25 Sep 2020 12:58:04 +0200 Subject: [PATCH] Removed some redundancies --- UPDATE_NOTES.md | 3 +-- .../java/cz/tefek/pluto/chrono/MiniTime.java | 20 +++++++++---------- .../event/lambda/LambdaEventFactory.java | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/UPDATE_NOTES.md b/UPDATE_NOTES.md index fc1582f..f743dc1 100644 --- a/UPDATE_NOTES.md +++ b/UPDATE_NOTES.md @@ -4,16 +4,15 @@ * `build.gradle` Updated the build scripts and added source Maven publication * `[PlutoLib]` Renamed the `cz.tefek.pluto.eventsystem` package to `cz.tefek.pluto.event` * Moved all subpackages - * Updated all references * `[PlutoLib]` Minor code cleanup in `cz.tefek.pluto.modloader.event` * `[Pluto]` Moved `TPL` from `cz.tefek.pluto.tpl` to `cz.tefek.pluto.io.tpl` - * Updated all references * `[PlutoMesher]` Renamed all occurrences of `attrib` to `attribute` * Renamed `VertexArray#createArrayAttrib` to `VertexArray#createArrayAttribute` * Renamed `VertexArray#getVertexAttribs` to `VertexArray#getVertexAttributes` * `[PlutoCore]` Made `PlutoApplication.StartupConfig` fields private, options can now only be modified only through public setters * `[PlutoLib]` Added the `ThreadSensitive` annotation +* `[PlutoLib]` Renamed `MiniTimeCouldNotBeParsedException` to `MiniTimeParseException` * `[PlutoCore]` Refactored `InputBus` and added several convenience methods * `[PlutoCore]` Refactored input callbacks * `[PlutoStatic]` Slight cleanup in the `Display` and `DisplayBuilder` classes diff --git a/plutolib/src/main/java/cz/tefek/pluto/chrono/MiniTime.java b/plutolib/src/main/java/cz/tefek/pluto/chrono/MiniTime.java index 2465ae4..8b4cffd 100644 --- a/plutolib/src/main/java/cz/tefek/pluto/chrono/MiniTime.java +++ b/plutolib/src/main/java/cz/tefek/pluto/chrono/MiniTime.java @@ -43,14 +43,14 @@ import java.util.concurrent.TimeUnit; */ public class MiniTime { - private static class MiniTimeCouldNotBeParsedException extends RuntimeException + private static class MiniTimeParseException extends RuntimeException { /** * */ private static final long serialVersionUID = -5403949842120041373L; - public MiniTimeCouldNotBeParsedException() + public MiniTimeParseException() { super("Time period could not be parsed. Correct format: \\_w\\_d\\_h\\_m\\_s **without spaces** between the units. You can skip a time unit. Example: 1h15m"); } @@ -84,7 +84,7 @@ public class MiniTime // Nothing to parse if (input.isEmpty()) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } if (input.equalsIgnoreCase("forever")) @@ -95,25 +95,25 @@ public class MiniTime // Follow the scheme if (!input.matches("[0-9]*[wW]?[0-9]*[dD]?[0-9]*[hH]?[0-9]*[mM]?[0-9]*[sS]?")) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } // 4584 of what? Potatoes? if (input.matches("[0-9]+")) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } // Where are the numbers? if (input.matches("[a-zA-Z]+")) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } // It shouldn't start with a letter if (input.matches("^[a-zA-Z].+")) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } var nrs = input.split("[a-zA-Z]"); @@ -121,7 +121,7 @@ public class MiniTime if (nrs.length != letters.length) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } long time = 0; @@ -138,7 +138,7 @@ public class MiniTime } catch (NumberFormatException nfe) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } var allow = 0L; @@ -184,7 +184,7 @@ public class MiniTime if (number > allow) { - throw new MiniTimeCouldNotBeParsedException(); + throw new MiniTimeParseException(); } time += multiplier * number; diff --git a/plutolib/src/main/java/cz/tefek/pluto/event/lambda/LambdaEventFactory.java b/plutolib/src/main/java/cz/tefek/pluto/event/lambda/LambdaEventFactory.java index 54128eb..c792464 100644 --- a/plutolib/src/main/java/cz/tefek/pluto/event/lambda/LambdaEventFactory.java +++ b/plutolib/src/main/java/cz/tefek/pluto/event/lambda/LambdaEventFactory.java @@ -25,7 +25,7 @@ public class LambdaEventFactory */ public static class LambdaEvent { - private List> consumers; + private final List> consumers; private LambdaEvent() {