Removed some redundancies

This commit is contained in:
Tefek 2020-09-25 12:58:04 +02:00
parent 279d23206b
commit 03f21b2d74
3 changed files with 12 additions and 13 deletions

View File

@ -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

View File

@ -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;

View File

@ -25,7 +25,7 @@ public class LambdaEventFactory
*/
public static class LambdaEvent<T>
{
private List<Consumer<T>> consumers;
private final List<Consumer<T>> consumers;
private LambdaEvent()
{