diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-12-28 00:49:28 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-28 16:49:28 +1100 |
| commit | ea3ec354ba3bb5b4ac64b8032816b8e4c407f099 (patch) | |
| tree | 2a1b35a90a5b2e430ed8b09cfb0c6c8e28166039 /src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java | |
| parent | 0aa264dd9df3205cf9641f052b6622fd36b811d5 (diff) | |
| download | notenoughupdates-ea3ec354ba3bb5b4ac64b8032816b8e4c407f099.tar.gz notenoughupdates-ea3ec354ba3bb5b4ac64b8032816b8e4c407f099.tar.bz2 notenoughupdates-ea3ec354ba3bb5b4ac64b8032816b8e4c407f099.zip | |
more code clean up (#38)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java index a408100d..449fff1e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java @@ -45,7 +45,6 @@ import java.util.regex.Pattern; import static io.github.moulberry.notenoughupdates.util.GuiTextures.*; public class CustomAH extends Gui { - private enum PriceFilter { Greater, Less, @@ -439,21 +438,19 @@ public class CustomAH extends Gui { GlStateManager.disableBlend(); } - private final HashMap<Pattern, Long> timeParseMap = new HashMap<>(); + private final HashMap<Pattern, Long> timeParseMap = new HashMap<Pattern, Long>() {{ + Pattern dayPattern = Pattern.compile("([0-9]+)d"); + Pattern hourPattern = Pattern.compile("([0-9]+)h"); + Pattern minutePattern = Pattern.compile("([0-9]+)m"); + Pattern secondPattern = Pattern.compile("([0-9]+)s"); - public long prettyTimeToMillis(String endsInStr) { - if (timeParseMap.isEmpty()) { - Pattern dayPattern = Pattern.compile("([0-9]+)d"); - Pattern hourPattern = Pattern.compile("([0-9]+)h"); - Pattern minutePattern = Pattern.compile("([0-9]+)m"); - Pattern secondPattern = Pattern.compile("([0-9]+)s"); - - timeParseMap.put(dayPattern, 24 * 60 * 60 * 1000L); - timeParseMap.put(hourPattern, 60 * 60 * 1000L); - timeParseMap.put(minutePattern, 60 * 1000L); - timeParseMap.put(secondPattern, 1000L); - } + put(dayPattern, 24 * 60 * 60 * 1000L); + put(hourPattern, 60 * 60 * 1000L); + put(minutePattern, 60 * 1000L); + put(secondPattern, 1000L); + }}; + public long prettyTimeToMillis(String endsInStr) { if (endsInStr != null) { long timeUntilEnd = 0; |
